4 inserting string characters, 5 extracting string characters, 6 string use of ascii / ansii codes – Campbell Scientific CR1000 Measurement and Control System User Manual
Page 239: Crbasic example 48. inserting string characters

Section 7. Installation
239
7.8.13.4 Inserting String Characters
CRBasic Example 48. Inserting String Characters
Objective:
Use MoveBytes() to change "123456789" to "123A56789"
Given:
StringVar(7) = "123456789"
'Result is
"123456789"
Try (does not work):
StringVar(7,1,4) = "A"
'Result is
"123A
Instead, use:
StringVar(7) = MoveBytes(Strings(7,1,4),0,"A",0,1)
'Result is
"123A56789"
7.8.13.5 Extracting String Characters
A specific character in the string can be accessed by using the "dimensional"
syntax; that is, when the third dimension of a string is specified, the third
dimension is the character position.
Table 41. Extracting String Characters
Expression Comments
Result
StringVar(3) = "Go Jazz"
Loads string into variable
StringVar(3) = "Go Jazz"
StringVar(4) = StringVar(3,1,4)
Extracts single character
StringVar(4) = "J"
7.8.13.6 String Use of ASCII / ANSII Codes
Table 42. Use of ASCII / ANSII Codes Examples
Expression Comments
Result
LongVar (7) = ASCII("#")
35
LongVar (8) = ASCII("*")
42
LongVar (9) = "#"
Cannot be converted to Long with
NULL
NAN
LongVar (1) = "#"-""
Can be converted to Long without
NULL
35