Siebel VB Language Reference > Methods Reference for Siebel VB > Mathematical Methods >

Get Integer Method


The Get Integer method returns the integer part of a number:

  • For a positive number, it removes the fractional part of the expression and returns the integer part only.
  • For a negative number, it returns the largest integer that is less than or equal to the expression. For example:
    • Int (6.2) returns 6.
    • Int(-6.2) returns negative 7.
Format

Int(number)

This method uses the same arguments as the Get Absolute Value method. For more information, see Get Absolute Value Method.

Similarities Between the Get Integer Method and the Get Rounded Integer Method

The Get Integer method performs the same work as the Get Rounded Integer method except it handles negative numbers differently. For example:

  • Int(-8.347) = -9
  • Fix(-8.347) = -8

For more information, see Get Rounded Integer Method.

How The Get Integer Method Handles Variant Types

The return type matches the type of the numeric expression. This includes a variant expression that returns the same variant type as the input value except for the following items:

  • The string variant type returns as the double variant type.
  • An empty variant type returns as a long variant type.

For more information, see Variants.

Example

The following example uses the Get Integer method to create random numbers in the range of ASCII values for lowercase a through z. This ASCII range is 97 through 122. It converts the values to letters and displays them as a string:

Sub Button_Click
   Dim x As Integer, y As Integer
   Dim str1 As String, letter As String
   Dim randomvalue As Double
   Dim upper As Integer, lower As Integer
   Dim msgtext, newline
   upper = Asc("z")
   lower = Asc("a")
   newline = Chr(10)
   Randomize
   For x = 1 to 26
      randomvalue = Int(((upper - (lower + 1)) * Rnd) + lower)
      letter = Chr(randomvalue)
      str1 = str1 & letter
   'Need to waste time here for fast processors
      For y = 1 to 1500
      Next y
   Next x
   msgtext = "The string is:" & newline
      msgtext = msgtext & str1
End Sub

Siebel VB Language Reference Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Legal Notices.