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

38
COMMANDS AND FUNCTIONS
Splits apart a string into an array of strings. The first parameter provides the string to split apart.
The second parameter provides the array which the new substrings will fill. The optional third
parameter provides the delimiters or characters that determine where to split the primary string. If
more than one delimiter is specified, splitting will occur at each character given. For example, if a
comma and hyphen are given “,-”, content will be split on any commas or hyphens found as in the
example below. If no delimiter is specified, whitespace will be used as the delimiter (e.g. spaces
and tabs).The number of strings found is returned.
Empty elements in the array are not created if two delimiters are next to each other. The SPLIT
function, on the other hand, does add empty elements if two or more delimiters are in sequence.
The array will be automatically sized (larger or smaller) based on the number of strings that are
produced by the split. The number of strings produced will also be returned by the function.
var$ = “A1,B2,C3,D4,-A1,-B2”
ARRAY arr$(1)
array_num = TOKEN(var$, arr$(), “,-”) REM split on commas, returns 6
REM array arr$ now contains [A1][B2][C3][D4][A1][B2]
TOKEN (string, array, string)
Returns the given string with all whitespace removed from both the left and right side.
var$ = TRIM$(“ A1,B2,C3,D4 “) REM sets var$ to A1,B2,C3,D4
TRIM$ (string)
A read-only constant containing the number 1.
var = DATETIME(MINUTES)
top_of_hour = FALSE
IF (var ==0) THEN
top_of_hour = TRUE
ENDIF
TRUE
Marks the end of a conditional loop encompassed by REPEAT and UNTIL. The condition is given
after the UNTIL statement and while evaluated as TRUE, will continue to iterate through the loop.
Once the UNTIL condition is evaluated as FALSE, the loop exits.
REPEAT
REM Break out of the loop when our seconds are greater than 30
x = DATETIME(SECONDS)
UNTIL (x > 30)
UNTIL