Call 66 – insert a string in a string, Call 66 – insert a string in a string -8, Purpose – Rockwell Automation 1746-BAS BASIC LANGUAGE User Manual

Page 250: Syntax, Example

Advertising
background image

Publication 1746-RM001A-US-P

15-8 String Functions

CALL 66 – Insert a String
in a String

Purpose

Use CALL 66 to insert a string within another string. The CALL expects three
arguments. The first argument is the position at which to begin the insert. The
second argument is the string number of the characters inserted into the base
string. The third argument is the number of the base string. This routine has no
output arguments.

Syntax

PUSH [insert position]
PUSH [string number of inserted character]
PUSH [base string number]
CALL 66

Example

>1

REM EXAMPLE PROGRAM

>10

REM SAMPLE ROUTINE TO INSERT A STRING IN A STRING

>20

STRING 100,15

>30

$(0) = “1234590”

>40

$(1) = “67890”

>50

PRINT “BEFORE:”

>60

PRINT “$(0) = ”,$(0)

>70

PUSH 6 : REM POSITION TO START THE INSERT

>80

PUSH 1 : REM STRING NUMBER TO BE INSERTED

>85

PUSH 0 : REM BASE STRING NUMBER

>90

CALL 66 : REM INVOKE INSERT A STRING IN A STRING

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

>110 END

READY

>RUN

BEFORE:

$(0) = 1234590

$(0) = 123456789090

READY

>

IMPORTANT

If the new string length exceeds the length allocated by the string
command, an error message is printed on the console device and
the module enters Command mode.

Advertising