Truncates a decimal number, making it an integer.
Syntax
$truncate(number)
Parameters
| number | a number, or an expression that evaluates to a number |
Return Value
Number, with no decimal places.
Example
$truncate(2.49)
Evaluates to 2.
$truncate(2.99)
Evaluates to 2.
int1 - $truncate(int1/int2) * int2
Performs int1 modulo int2. Can also be expressed as $modulus(int1,int2).
See Also
$modulus
$round
$tonumber
Trims trailing blanks from a character string.
Syntax
$ttrim(string)
Parameters
| string | a character string, or any expression that evaluates to a character string |
Return Value
Character string.
Comments
Use $ttrim to remove trailing spaces from a character string.
For output purposes, the implicit length of the result returned by $ttrim is the same as the length of string.
Example
$ttrim (LastName)
Evaluates to “Smith” if LastName is stored as “Smith “.
detail line $concat($ttrim(LastName),", ",FirstName)
Displays a last name first in a report.
See Also
$ltrim
Converts alphabetic characters to upper case.
Syntax
$toupper(source)
Parameters
| source | any value, or an expression that yields any value |
Return Value
Character string, in which all letters are uppercase.
Comments
$toupper returns a character string in which all letters are upper case. If source is not of a character data type, it is converted to a character data type before the function is applied.
Example
$toupper("the QUICK BROWN fox is 30 years oLD")Evaluates to “THE QUICK BROWN FOX IS 30 YEARS OLD”.
See Also
$tolower
Tests if Zim is connected to a particular server.
Syntax
$isconnected(string)
Parameters
| string | a character string or an expression that evaluates to a character string |
Return Value
1-character binary string. Evaluates to 1 ($True) if Zim is connected to the server name contained in string; if the server name is invalid or there is no connection, Â evaluates to 0 ($False).
Example
$isconnected("ZIMSERV")Evaluates to $True if a previous CONNECT statement to ZIMSERV was successfully issued.
See Also
CONNECT
DISCONNECT
Extracts the day number associated with a specified date value.
Syntax
$day(date)
Parameters
| date | a data, or an expression that evaluates to a date, in the form YYYYMMDD |
Return Value
Character string.
Comments
This function extracts day information from standard date values. Date is often the system variable $Date.
Example
$day(19981225)
Evaluates to “25”.
$day($date+7)
Evaluates to “1” when $Date is 19991225.
See Also
$adddays
$Date
$dayname
$month
$monthname
$weekday
$year
Calculates the arcsine of a number.
Syntax
$asin(number)
Parameters
| number | a number, or an expression that evaluates to a number |
Return Value
Number, with the same number of decimal places as number.
Comments
Use $asin to calculate the arcsine (in radians) of a number. The value returned by this function has the same number of decimal places as number. The absolute value of the number must be between 0 and 1.
Example
let vAngle[2] = $asin(0.500)
The preceding command sets the second element of array variable vAngle to 0.524.
See Also
$acos
$atan
$atan2
$sin
$sinh
About Functional Expressions
Performs a bit-wise NOT of a value.
Syntax
$not(char)
Parameters
| char | a character string, or an expression that evaluates to a character string |
Return Value
Character string.
Comments
The $not function reverses the bit pattern of a single character in the fashion of a Boolean NOT and returns the resulting character.
If the char string contains more than one character, only the first character in the string (one byte) is processed. Char can be expressed as a hex code.
Example
$not("E")The bit pattern of hex 0E is 00001110. The above expression reverses the bit pattern to 11110001 (hex F1).
See Also
$and
$or
About Character Literals
About Functional Expressions
Returns the larger of a pair of numbers.
Syntax
$maxof(number1,number2)
Parameters
| number1 | a number or an expression that evaluates to a number |
| number2 | a number or an expression that evaluates to a number |
Return Value
The value returned by $maxof has the same number of decimal places as the number that is returned.
Comments
The function returns the larger of a pair of numbers.
Example
if event.eventname = "up"
let IndexPtr = $maxof(IndexPtr-1, 1)
else
... other commands ...
endif
Modifies an array index, without letting the index drop below 1.
See Also
$minof
About Functional Expressions
Returns the length of a character string.
Syntax
$length(string)
Parameters
| string | a character string or an expression that evaluates to a character string |
Return Value
Number.
Comments
If string is a complex arithmetic expression, then the result of $length(string) is always 17. Arithmetic expressions are evaluated using the data type vastint so that the largest possible number can always be handled. When converted to a string, a vastint value occupies 17 positions, regardless of its numeric value.
Example
$length("abcdefgh")Evaluates to 8.
$length(5*3)
Evaluates to 17.
Returns the smaller of a pair of numbers.
Syntax
$minof(number1,number2)
Parameters
| number1 | a number or an expression that evaluates to a number |
| number2 | a number or an expression that evaluates to a number |
Return Value
The value returned by $minof has the same number of decimal places as the number that is returned.
Comments
The function returns the larger of a pair of numbers.
Example
if event.eventname = "down"
let IndexPtr = $minof(IndexPtr+1, ArrayLen)
else
... other commands ...
endif
Modifies an array index, without letting the index exceed the specified number.
See Also
$maxof
About Functional Expressions