3 string null character – Campbell Scientific CR1000 Measurement and Control System User Manual
Page 238

Section 7. Installation
238
Table 39. String Concatenation Examples
Expression Comments Result
Str(1) = 5.4 + 3 + " Volts"
Add floats, concatenate strings
"8.4 Volts"
Str(2) = 5.4 & 3 & " Volts"
Concatenate floats and strings
"5.43 Volts"
Lng(1) = "123"
Convert string to long
123
Lng(2) = 1+2+"3"
Add floats to string / convert to long
33
Lng(3) = "1"+2+3
Concatenate string and floats
123
Lng(4) = 1&2&"3"
Concatenate floats and string
123
7.8.13.3 String NULL Character
All strings are automatically NULL terminated. NULL, Chr(0) or "", counts as
one of the characters in the string. Assignment of just one character is that
character followed by a NULL, unless the character is a NULL.
Table 40. String NULL Character Examples
Expression Comments
Result
LongVar(5) = "#"-""
Subtract NULL, ASCII code results
35
LongVar(6) = StrComp("#","")
Also subtracts NULL
35
Example:
Objective:
Insert a NULL character into a string, and then reconstitute the string.
Given:
StringVar(3) = "123456789"
Execute:
StringVar(3,1,4) = "" "123
Results:
StringVar(4) = StringVar(3) "123"
But,
StringVar(3) still = "123
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.