Basic programming guide – Remote Processing BASIC for the CX-10 Modbus User Manual

Page 70

Advertising
background image

BASIC PROGRAMMING GUIDE

2-61

STR

Syntax:

A = STR(function,$(n)[,$(n)]))
Where: function = 0 to 14, specifies string function to perform as described below.

Function:

Performs string manipulation, described below, per function number.

Mode:

Command,Run

Use:

A = STR(0,$(0))

Cards:

RPC-320, RPC-330

DESCRIPTION

There are 11 string manipulation functions using STR. Each function is described below.

NOTE: Most of these functions require a string variable (such as $(0)) rather than a quoted string. Functions
which will allow quoted strings offer an alternate syntax immediately below the first one.

Syntax:

A = STR(0,$(n))

Description:

Returns number of characters in a string. When string is not set equal to something, or the string number is
out of bounds, erroneous data is returned. Length limit is 254 characters.

Example:

10

STRING 100,20

20 $(0)=" 123456789"
30

PRINT STR(0,$(0))

run

10

Syntax:

A = STR(1,$(n))

Description:

Convert letters A - Z to lower case. Variable A returns length of the string.

Example:

10

STRING 100,20

20 $(0)="Some UPPER case"
30 A = STR(1,$(0))
40

PRINT $(0)

run
some upper case

Syntax:

A = STR(2,$(n))

Description:

Convert letters a - z to upper case. Variable A returns length of the string.

Example:

10

STRING 100,20

20 $(1) = "Some lower case."
30 A = STR(2,$(1))
40

PRINT $(1)

run
SOME LOWER CASE.

Advertising