beautypg.com

ProSoft Technology MVI56-BAS User Manual

Page 151

background image

MVI56-BAS ♦ ControlLogix Platform

BASIC CALLs Syntax

BASIC Module (DB/BAS Compatible)

User Manual

ProSoft Technology, Inc.

Page 151 of 234

December 13, 2011

CALL 64: Finding a String within Another String

CALL 64 finds a string in another string returning the first occurrence location in

the string:

PUSH [A]
PUSH [B]
CALL 64
POP [C]

Where:
A = string number to be found
B = string number searched for string A
C = position number in string B

Example:

Ready
>list
10 STRING 100, 20
20 $ ( 1) = "456"
30 $ ( 2) = "12345678"
40 PUSH 1, 2: CALL 64: POP L
50 IF ( L = 0) THEN PRINT "Not found!"
60 IF ( L > 0) THEN PRINT "Found at location", L
70 END
Ready
>run
Found at location 4
Ready
>