Intrinsic Script Functions

The tables below describe the syntax for the intrinsic script functions.

Arithmetic Functions

Function

Returns

Example

SQRT(float_number)

Square root of "float_number"

SQRT(2.0) → 1.41…

SIN(float_number)

Sine of "float_number"

SIN(45) → 0.707…

ASIN(float_number)

Arcsine of "float_number"

ASIN(0.707…) → 45.0

EXP(float_number)

"e" raised to the power of "float_number"

Base "e" = 2.71828…

EXP(1) → 2.718…

LOG(float_number)

Natural logarithm of "float_number".

Base "e" = 2.71828…

LOG(2.718…) → 1.0

ATAN2(float_y,float_x)

The angle between positive X axis and the "ray" from (0,0) to (x,y) in degrees

Important: Note the order of arguments!

ATAN2(0.0,15.0) → 0.0

ATAN2(15.0,15.0) → 45.0

ATAN2(15.0,-15.0) → 135.0

ATAN2(0.0,-15.0) → 180.0

ATAN2(-15.0,-15.0) → -135.0

ATAN2(-15.0,15.0) → -45.0

Character String Functions

Function

Returns

Example

SUBSTRING(s,n)

Tail of string "s", starting from s[n]

SUBSTRING("abc",1) → "bc"

HEAD(s,n)

First n characters of string "s"

HEAD("abc",1) → "a"

TAIL(s,n)

Last n characters of string "s"

TAIL("abc",1) → "c"

SEARCH(s,patt)

Tail of string "s", starting from the pattern

SEARCH("abc","b") → "bc"

STRINGTERM(s,patt)

Head of string "s", ending before the pattern

STRINGTERM("abc","b") → "a"

TRANS(s,patt,patt2)

Replace "patt" characters with "patt2" characters in string "s"

"patt" and "patt2" can contain several characters, they are replaced one by one

TRANS("abc","ab","bd") → "bdc"

STRLEN(s)

Number of characters in string "s"

STRLEN("abc") → 3

APPEND(s,s2)

Combine strings

Obsolete; use string assignment s = s + s2 instead:

s = "abc"

s2 = "def"

s = s + s2

s = "abcdef"

Example

The code example below shows a typical use case of using intrinsic functions to manipulate character strings. The code is for an OK button handler of a multi-selectable list window user interface, and it uses string intrinsics for converting the bit string received from the user interface to the row indices of the selected rows.

Miscellaneous Functions

Function

Returns

ISINT(arg)

Based on the argument's data type, the logical true (int 1) or false (int 0)

ISFLOAT(arg)

Based on the argument's data type, the logical true (int 1) or false (int 0)

ISSTRING(arg)

Based on the argument's data type, the logical true (int 1) or false (int 0)

TRAP()

Starts the script debugger