Rockwell Automation 1771-DB Basic Module User Manual - Series A User Manual

Page 121

Advertising
background image

Operating Functions

Chapter 5

5–84

5.10.3.6
Replace a String in a String – CALL 65

This routine replaces a string within a string. Three arguments are
expected. The first argument is the string number of the string which
replaces the string identified by the second argument string number. The
third argument is the base string’s string number. There are no return
arguments.

u10 REM SAMPLE OF REPLACE STRING IN STRING

u20 STRING 1000,20

u30 $(0)=“RED-LINES”

u40 $(1)=“RED”

u50 $(2)=“BLUE” u60 PRINT “BEFORE: $0=”,$(0)

u70 PUSH 2 :REM STRING NUMBER OF THE STRING TO REPLACE WITH

u80 PUSH 1 :REM STRING NUMBER OF THE STRING TO BE REPLACED

u90 PUSH 0 :REM BASE STRING NUMBER

u100 CALL 65 :REM INVOKE REPLACE STRING IN STRING ROUTINE

u110 PRINT “AFTER: $0=”,$(0)

u120 END
RUN
BEFORE: $=RED-LINES
AFTER: $0=BLUE-LINES
READY

5.10.3
String Support Calls
(continued)

Advertising