Call 68: determine length of a string, What’s next, Call 68: determine length of a string what’s next – Rockwell Automation 1771-DB BASIC MODULE User Manual
Page 257

Chapter
Call Routines 0–68
12
12 -67
Use this routine to determine the length of a string. To properly determine
the length of a string you must terminate the string with a CR character.
If you use the ASC string operator (page 9 -14) to fill the string, you must
add a CR as the last character to terminate the string.
Input and Output Arguments
This routine has one input and one output argument. The input is the string
number on which the routine acts. The output is the actual number of
non-carriage return (CR) characters in this string.
Syntax
PUSH
number of string to determine length
CALL 68
POP
number of characters in string
Example
>10 REM SAMPLE OF STRING LENGTH
>20 STRING 100,10
>30 $(1)=“1234567”
>40 PUSH 1 : REM BASE STRING
>50 CALL 68 : REM INVOKE STRING LENGTH ROUTINE
>60 POP L : REM GET LENGTH OF BASE STRING
>70 PRINT “THE LENGTH OF”,$(1),” IS ”,L
>80 END
>RUN
THE LENGTH OF 1234567 IS 7
Call Routines
69–127
13
CALL 68: Determine Length
of a String
What’s Next?