Commands for string processing, 4 commands for string processing – Argox PA-20 Basic Programming Manual User Manual
Page 24

PT-Basic Programming Manual Ver. 1.00
23/143
3.4 Commands for string processing
Purpose: To return the length of a string.
Syntax: A% = LEN(S$)
Example: Str$="ABCDEFGHIJK"
L% = LEN(Str$)
PRINT "Len. = ",L%
Description: A% is an integer variable to be assigned to the result.
S$ may be a string variable, string expression, or string
constant.
Purpose: To search if one string exists inside antoher one.
Syntax: A% = INSTR([N%,] S1$, S2$)
Example: Str$="ABCGEFGHIJK"
G$="GH"
PRINT INSTR(5,Str$, G$)
PRINT INSTR(3, Str$, "CGE")
Description: A% is an integer variable to be assigned to the result.
N% is a numeric expression. Optional offset N% sets the
position for starting the search.
S1$, S2$ may be a string variable, string expression, or string
constant.
If S2$ is found in S1$, it returns the position of the first
occurrence of S2$ in S1$, from the starting point.
If N% is larger than the length of S1$ or if S1$ is null, of if
S2$ cannot be found,it return 0.
If S2$ is null,it return N%(or 1 if N% is not specified).