4.7.5 INSTR function
Returns the position of a sub string within a string, or 0 if not found.
Syntax:
INSTR <string to be searched> <string to look for>
INSTR <string to be searched> <string to look for> <start position expression>
<start position expression> is an expression and is optional.
Examples:
LET B = INSTR “HANS” “NS”
puts the value 3 in B because the substring “NS” is found at position 3 of the search string
“HANS”.
LET B = INSTR “HANS” “Z”
puts the value 0 in B because the substring “Z” is not found at all in the search string “HANS”.
LET B = INSTR “PROCRASTINATION” “A” 10
puts the value 11 into variable B, since the search for the substring “A” in the search string, is
started at character position 10.
Start position is an expression, and of course you can also use #-tags in both the string being
searched and the string being looked for. So:
LET B = INSTR “#TM” “#VZ”
looks for the value of variable Z in the current time. In my case the current time is 065924 and I
have not put anything into variable Z in this operating session, so it remains at its default value of
zero. So the value 1 is written into variable B because the substring “0” is found at character 1 of
the string being searched.
4.7.6 LEN function
Returns the length of the string.
Syntax:
LEN <string>
Example
LET C = LEN “HANS”
Puts the value 4 into variable C.
LET C = LEN “#TM”
puts the value 6 into variable C, because the #TM tag is replaced by the time, which I is a 6-
character value of the form HHMMSS (Hours Minutes Seconds).
U4B operating manual Rev 1.00
31