but,
StringVar(3) still = "123<NULL>56789",
so,
StringVar(5) = StringVar(3,1,4+1)
'"56789"
StringVar(6) = StringVar(3) + 4 + StringVar(3,1,4+1)
'"123456789"
Some smart sensors send strings containing NULL characters. To manipulate a
string that has NULL characters within it (in addition to being terminated with
another NULL), use MoveBytes() instruction.
7.9.19.4 Inserting String Characters
Example:
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<NULL>56789"
Instead, use:
StringVar(7) = MoveBytes(Strings(7,1,4),0,"A",0,1) 'Result is
"123A56789"
7.9.19.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 49. 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"
286