The extraction operations are substring (substr), randomize (rand), round, and truncate. These operators are equal in precedence, and all take precedence over the string operator.
You can use the substring operator (substr) to extract a shorter string from a longer string. To use the substring operator, you must specify the source string, an offset value, and a count value. You can specify the string directly, or you can specify a local variable that contains the string. The offset value indicates the place of the first character of the substring to be extracted; “ 0” indicates the first character in the source string. The count value indicates the length of the substring. If the source string has fewer characters than the sum of the offset and count values, then the resulting substring has fewer characters than indicated by the count value.
Example
<# local := “ want a ” $ “ big” $ “ string” #> <# substr(local, 5, 12) #>The result is “ a big string” <# substr(local, 0, 10) #>The result is “ want a big” <# substr(“ ready” , 0, 4) #>The result is “ read”
The random operator produces a random integer value from the specified inclusive range; in the following example, the result is between 1 and 10:
<# number:= rand(1,10) #>
The round operator rounds off the number to the nearest integer:
<# decimal:= 4.7 #> <# round(decimal) #>The result is decimal is now 5
The truncate operator truncates noninteger numbers to the value left of the decimal point:
<# decimal:= 4.7 #> <# truncate(decimal) #>The result is decimal is now 4