5. WMLScript Lang Standard Library Quick Reference
WMLScript's Lang standard library provides functions related to the WMLScript language core. It contains functions for generating random numbers, performing some arithmetic operations and dealing with data type conversion.
WMLScript Quick Reference: Functions in the Lang Standard Library |
abort(message)Ends the execution of WMLScript, and returns message and control to the WML browser. It is used for abnormal exit. Example: Lang.abort("Error code 110"); |
abs(numeric_value)Calculates the absolute value of numeric_value. Example: var
x = Lang.abs(-10.44); x
has the floating-point value 10.44. |
characterSet()Returns a MIBEnum value from IANA that represents the character set supported by the WMLScript interpreter. The MIBEnum value of character sets can be found at http://www.iana.org/assignments/character-sets. |
exit(value)Ends the execution of WMLScript, and returns value and control to the WML browser. It is used for normal exit. Example: Lang.exit(0); Lang.exit("OK"); |
float()Returns a Boolean value that tells whether floating-point numbers are supported. |
isFloat(string)Returns a Boolean value that tells whether the conversion of string into a floating-point number is possible. Example: var
toFloatOK1 = Lang.isFloat("23.21"); toFloatOK1
has the Boolean value true. |
isInt(string)Returns a Boolean value that tells whether conversion of string into an integer is possible. Example: var
toIntegerOK1 = Lang.isInt("22"); toIntegerOK1
has the Boolean value true. |
max(numeric_value1, numeric_value2)Returns numeric_value2 if numeric_value2 is greater than numeric_value1. Otherwise returns numeric_value1. Example: var
larger_number1 = Lang.max(10.5, 100); Example: larger_number1
has the integral value 100. |
maxInt()Returns the largest integer that can be represented, which should be 2147483647. |
min(numeric_value1, numeric_value2)Returns numeric_value2 if numeric_value2 is smaller than numeric_value1. Otherwise returns numeric_value1. Example: var
smaller_number1 = Lang.min(10, 100.5); Example: smaller_number1
has the integral value 10. |
minInt()Returns the smallest integer that can be represented, which should be -2147483648. |
parseFloat(string)Converts string to a floating-point number. Example: var
float_number1 = Lang.parseFloat("1.22"); float_number1
has the floating-point value 1.22. |
parseInt(string)Converts string to an integer. Example: var
integer1 = Lang.parseInt("2334"); integer1 has the integral value 2334. integer2 has the value invalid. |
random(numeric_value)Returns a random integer in the range 0 to numeric_value. Example: var random_number = Lang.random(2); random_number has an integral value 0, 1 or 2. |
seed(numeric_value)If numeric_value < 0, the value used to initialize the random number generator will be determined by the mobile device randomly, otherwise numeric_value is used to initialize the random number generator. Example: Lang.seed(-1); |
Previous Page | Page 5 of 6 | Next Page |
- 1. WMLScript WMLBrowser Standard Library Quick Reference
- 2. WMLScript Dialogs Standard Library Quick Reference
- 3. WMLScript String Standard Library Quick Reference
- 4. WMLScript Float Standard Library Quick Reference
- 5. WMLScript Lang Standard Library Quick Reference
- 6. WMLScript URL Standard Library Quick Reference