Commands and functions – Xylem STORM 3 Basic Programming manual User Manual
Page 28

Returns the given string with all whitespace removed from only the left side.
var$ = LTRIM$(“ A1,B2,C3,D4 “) REM sets var$ to “A1,B2,C3,D4 “
26
COMMANDS AND FUNCTIONS
LTRIM$ (string)
Returns the maximum value of the two given numbers.
a = RND()
REM generates a random number between 0 and 1
b = RND()
REM generates a random number between 0 and 1
c = MAX(a, b)
REM sets c to the largest of the two numbers
MAX (number, number)
Returns a smaller section (substring) of a given string. The first parameter is the given string, the second
is the starting point from the left side, and the third optional parameter dictates how many characters to
return. If the third parameter is omitted, all remaining characters are returned.
var$ = MID$(“A2: 12.5, VB: 12.250”, 11) REM sets var$ to VB: 12.250
myStr$ = “A1: 15, A2: 18, D3: 0”
var$ = MID$(myStr$, 9, 6) REM sets var$ toA2: 18
MID$ (string, number, number)
Returns the minimum value of the two given numbers.
a = RND()
REM generates a random number between 0 and 1
b = RND()
REM generates a random number between 0 and 1
c = MIN(a, b)
REM sets c to the smallest of the two numbers
MIN (number, number)
Returns the remainder of a division between the two given numbers. MOD performs floating-point
division and returns the remainder. For integer-only division, use the % operator.
a = 102.5
b = 10
var = MOD(a, b)
REM sets var to 2.5 (the remainder of 102.5/10)
var = a % b
REM sets var to 2 (the remainder of 102/10)
MOD (number, number)
Declares the end of a FOR loop.
FOR x = 1 TO 10 STEP 2
REM retrieve the every other value for the Sensor named “Analog”
GETVALUE SENSOR “Analog” x, var$
NEXT x
NEXT