The Lang library contains functions for absolute value calculations, data type manipulation, and random number generation.
WMLScript Lang Library包括绝对值计算、日期类型处理以及随机数值触发等函数。
WMLScript Lang Library Functions
WMLScript Lang Library函数
Function 函数 | Description 描述 |
abort() | Aborts a WMLScript and returns a message to the caller of the script 放弃一个WMLScript并为脚本的请求着返回一条信息 |
abs(x) | Returns the absolute value of a number 返回数字的绝对值 |
characterSet() | Returns the character-set supported by the WMLScript interpreter 返回WMLScript解释器支持的字符属性(character-set) |
exit() | Exits a WMLScript and returns a message to the caller of the script 退出WMLScript并为脚本请求者返回一条信息 |
float() | Returns a Boolean value that indicates whether floating-point numbers are supported 返回一个逻辑值来指明是否支持浮点数值(floating-point number) |
isFloat() | Returns a Boolean value that indicates whether a value can be converted into a floating-point number by the parseFloat() function 返回一个逻辑值指明是否可以通过parseFloat()函数将一个值转换为一个浮点数值 |
isInt() | Returns a Boolean value that indicates whether a value can be converted into an integer by the parseInt() function 返回一个逻辑值指明是否可以通过parseFloat()函数将一个值转换为一个整数 |
max(x,y) | Returns the number with the highest value of x and y 返回x与y二者相比较大的那个数值 |
maxInt() | Returns the maximum possible integer value 返回最大可支持的整数值 |
min(x,y) | Returns the number with the lowest value of x and y 返回x与y二者相比较小的那个数值 |
minInt() | Returns the minimum possible integer value 返回最小可支持的整数值 |
parseFloat() | Returns a floating-point value defined by a string 返回一个由字符串定义的浮点数值 |
parseInt() | Returns an integer defined by a string 返回一个由字符串定义的整数值 |
random(x) | Returns a random integer between 0 and x 随机返回一个从“0”到“x”之间的整数 |
seed() | Initializes the random number generator with a number, and returns an empty string 通过一个数字来初始化随机数值发生器,并且返回一个空字符串 |
Note: We think that the Lang library has a misleading name (should be named Math library or something like that). However, it is called the Lang library because it contains functions that are closely related to the core of the WMLScript engine.
注意:我们普遍认为“Lang库(Library)”这个名字听上去让人费解(是否该把它命名为数学库(Math Library)或者与其相类似的名字呢?)。然而,它之所以被称为“Lang 库(Library)”是因为它包含了与WMLScript引擎(engine)的核心极其相关的函数。