String routines – Rockwell Automation 1747-PBASE BASIC Development Software Programming Manual User Manual

Page 129

Advertising
background image

Publication 1746-PM001A-US-P

BASIC Macro Library A-7

String Routines

The following table describes the macro CALLs used for string routines.

Table A.7 String Routine Macros

String Routine
Macro CALLs

Macro

Inputs

Outputs

string_repeat(%1,%2)

Allows you to repeat a character %1 times and
copy it into $(%2).

%1 = Number of times to
repeat the character.
%2 = The string number
containing the character.

$(%2) = The new
string.

string_append(%1,%2)

Concatenates two strings (%1 and %2), then stores
the result in %2.

%1 = Number of string to
be appended.
%2 = Number of the base
string.

$(%2) = The
concatenated string.

num_to_str(%1,%2)

Converts %1 from a numeric value to a string, then
stores the result in $(%2).

%1 = Value to be
converted.
%2 = Number of the base
string.

$(%2) = The string
converted data.

str_to_num(%1,%2,%3)

Converts (%1) from a string to a numeric value, then
stores the result in (%3). %2 is a validity code.

%1 = String number to be
converted.

%2 = Validity of
output value.
0 = Value not valid.
1 < Valid Value < 255
%3 = Converted
value.

find_str_in_str(%1,%2,%3)

Finds a string within a string. It locates the first
occurrence (position) of the string.

%1 = String to be found.
%2 = String to be
searched.

%3 = Result
0 = String not found
0 <> Found string

replace_str_in_str(%1,%2,%3) Replaces a string within a string.

%1 = String which
replaces the %2 string.
%2 = String to be
replaced.
%3 = Base String number.

$(%1) = Base string

insert_str_in_str(%1,%2,%3)

Inserts a string into a string.

%1 = Position to begin
insertion
%2 = Number of
characters to insert
%3 = Base String number

$(%1) = Base string

delete_str_in_str(%1,%2,%3)

Deletes a string from a string.

%1 = Base string number.
%2 = String number of
string to be deleted.

$(%1) = Base string.

get_string_length(%1,%2)

Determines the length of a string.

%1 = Base string number

%2 = String length

Advertising