Call 66: insert string in a string – Rockwell Automation 1771-DB BASIC MODULE User Manual

Page 255

Advertising
background image

Chapter
Call Routines 0–68

12

12 -65

Use this routine to insert a string within another string.

Input and Output Arguments

This routine has three input arguments and no output arguments. The first
argument is the position at which to begin the insert. The second argument
is the string number of the characters you want to insert into the base
string. The third argument is the string number of the base string.

Syntax

PUSH

position to begin insert

PUSH

string number of characters to be inserted

PUSH

base string number

CALL 66

Example

>10 REM SAMPLE ROUTINE TO INSERT A STRING IN A STRING

>20 STRING 500,15

>30 $(0)+“1234590”

>40 $(1)+“67890”

>50 PRINT “BEFORE: 0$=”,$(0)

>60 PUSH 6 :REM POSITION TO START THE INSERT

>70 PUSH 1 :REM STRING NUMBER OF STRING TO INSERT

>80 PUSH 0 :REM BASE STRING NUMBER

>90 CALL 66 :REM INVOKE INSERT A STRING IN A STRING

>91 REM: REM ROUTINE

>100 PRINT “AFTER: 0$=”,$(0)

>110 END

>RUN

BEFORE: 0$=1234590

AFTER: 0$=123456789090

CALL 66: Insert String in a
String

Advertising