dcsimg
www.webdeveloper.com
Results 1 to 3 of 3

Thread: Java equivalent of VBScript Int()

  1. #1
    Join Date
    Mar 2006
    Posts
    21

    Question Java equivalent of VBScript Int()

    Hello. I am looking for a function in Java that performs the same task as the Int() function in VBScript. The Int() function returns the integer part of a specified number.

    Examples:
    document.write(Int(6.83227))Output:6
    document.write(Int(6.23443))Output:6
    document.write(Int(-6.13443))Output:-7
    document.write(Int(-6.93443))Output:-7

    Thanks to anyone with any suggestions.

  2. #2
    Join Date
    Feb 2003
    Posts
    2,745
    floor() and ceil() are the closest. you could easily write your own int() or fix() function which would return the floor for positive numbers and the ceil for negative numbers. Check out the Math Class Function Reference

  3. #3
    Join Date
    Mar 2006
    Posts
    21
    Thanks russell. That's perfect.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles