beautypg.com

Rpbasic-52 programming guide – Remote Processing BASIC 52 User Manual

Page 123

background image

RPBASIC-52 PROGRAMMING GUIDE

2-104

Syntax:

A = ST R(3,$(n))

Description:

Retu rns num bers in a string as a rea l num ber. Sim ilar to V AL i n othe r Basi cs. Le ading space s are ig nored .
First non-num ber terminate s conversion at las t valid numb er. No valid num bers return 0. Num ber length is
limited to the first 12 valid numbers and decimal in a string. This means a number no greater than
99999 99999 999 is c onver ted to a num ber.

Example:

10 STRING 100,20
20 $(2) = "-23.452volts"
30 A= STR(3,$(2))
40 PRINT A
run
-23.452

Syntax:

A = ST R(4,$(n))

Description:

Trims spaces to left of first non-space character. Variable A returns length of trimmed string.

Example:

10 STRING 100,20
20 $(0) = " 1234"
30 A = STR(4,$(0))
40 PRINT $(0)
50 PRINT A
run
1234

4

Syntax:

A = ST R(5,$(n))

Description:

Trims spaces from right side of string. Variable A returns length of trimmed string.

Example:

10 STRING 100,20
20 $(0) = "ABCDE "
30 A = STR(5,$(0))
40 PRINT $(0)
50 PRINT A
run
ABCDE
5

Syntax:

A = ST R(6,$(x),$(y))
A = S TR( 6,$(x)," string")

Description:

Append s one string into anoth er. This function co ncatenates tw o strings in the form o f $(x) = $(x) + $(y).
Length of new string is returned in variable A. The variable $(y) could be a quoted string.

Example:

10 STRING 120,40
20 $(0)="First part"
30 $(1)=" Second part"
40 A = STR(6,$(0),$(1))
50 PRINT $(0)
60 PRINT "Length:",A
70 A = STR(6,$(0)," last part")
80 PRINT $(0)
90 PRINT "Length:",A
run
First part Second part
Length: 22
First part Second part last part

Length: 32

Lines 50 an d 80 print the conc atenated string $(0).