04.01.2015 Views

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Section 7. Installation<br />

Table 39. String Concatenation Examples<br />

Expression Comments Result<br />

Str(1) = 5.4 + 3 + " Volts" Add floats, concatenate strings "8.4 Volts"<br />

Str(2) = 5.4 & 3 & " Volts" Concatenate floats and strings "5.43 Volts"<br />

Lng(1) = "123" Convert string to long 123<br />

Lng(2) = 1+2+"3" Add floats to string / convert to long 33<br />

Lng(3) = "1"+2+3 Concatenate string and floats 123<br />

Lng(4) = 1&2&"3" Concatenate floats and string 123<br />

7.8.13.3 String NULL Character<br />

All strings are automatically NULL terminated. NULL, Chr(0) or "", counts as<br />

one of the characters in the string. Assignment of just one character is that<br />

character followed by a NULL, unless the character is a NULL.<br />

Table 40. String NULL Character Examples<br />

Expression Comments Result<br />

LongVar(5) = "#"-"" Subtract NULL, ASCII code results 35<br />

LongVar(6) = StrComp("#","") Also subtracts NULL 35<br />

Example:<br />

Objective:<br />

Given:<br />

Execute:<br />

Results:<br />

But,<br />

so,<br />

Insert a NULL character into a string, and then reconstitute the string.<br />

StringVar(3) = "123456789"<br />

StringVar(3,1,4) = ""<br />

StringVar(4) = StringVar(3) "123"<br />

StringVar(3) still = "12356789",<br />

"12356789"<br />

StringVar(5) = StringVar(3,1,4+1)<br />

'"56789"<br />

StringVar(6) = StringVar(3) + 4 + StringVar(3,1,4+1)<br />

'"123456789"<br />

Some smart sensors send strings containing NULL characters. To manipulate a<br />

string that has NULL characters within it (in addition to being terminated with<br />

another NULL), use MoveBytes() instruction.<br />

238

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!