Instr (string, string, number), Int (number), Input – Xylem STORM 3 Basic Programming manual User Manual
Page 25

23
Commands and Functions
Returns the position, starting at the position given by the third optional parameter (default is 1), of
the first occurrence of the second given string within the first given string beginning at the left. If
the string is not found, zero is returned. RINSTR may be used to begin searching for a string from
the right, rather than the left. Zero is returned if the value is not found.
var = INSTR(“A1,B2,C3,D4”, “B2”) REM sets var to 4
var = INSTR(“A1,B2,C3,D4,A1,B2”, “B2”, 5) REM sets var to 16
INSTR (string, string, number)
Returns the integer portion of the given number.
var = INT(26.245) REM sets var to 26
INT (number)
Read from a file or serial port that has been previously opened with the OPEN command. An
optional delimiter (stop character) may be specified for retrieving data. The default delimiter for
files is a space; the end of transmission EOT (0x04) character is used for serial communication.
When used with a serial port, an additional variable may be specified to set the timeout, in
milliseconds, for reading from the port (default is 100ms). Note that files will not return the stop
character whereas serial communication returns all characters (including the delimiter). Entire lines
of files can be retrieved using the LINE INPUT command.
OPEN “RS-232 COM” AS #3
INPUT #3 250, a$ REM timeout is set to 250ms
INPUT #3, b$ REM reads again with default 100ms timeout
INPUT #3 “,” 250, c$ REM read until a comma or 250ms passes
CLOSE #3
OPEN “RS-485” AS #2
INPUT #2 250, a$ REM timeout is set to 250ms
INPUT #2, b$ REM reads again with default 100ms timeout
INPUT #2 “,” 250, c$ REM read until a comma or 250ms passes
CLOSE #2
OPEN “SiteID.csv” FOR READING AS #1
INPUT #1, d$ REM retrieves characters until a space is found
INPUT #1 “\t”, e$ REM retrieves characters until a tab is found
INPUT #1 “,”, f$ REM retrieves characters until a comma is found
INPUT