Campbell-scientific CR1000 Measurement and Control System Manuale Utente Pagina 238

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
Vedere la pagina 237
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:
InsertaNULLcharacterintoastring,andthenreconstitutethestring.
Given:
StringVar(3) = "123456789"
Execute:
StringVar(3,1,4) = "" "123<NULL>56789"
Results:
StringVar(4) = StringVar(3) "123"
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.
Vedere la pagina 237
1 2 ... 233 234 235 236 237 238 239 240 241 242 243 ... 587 588

Commenti su questo manuale

Nessun commento