Campbell-scientific CR800 and CR850 Measurement and Control Systems Instrukcja Użytkownika Strona 239

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
Przeglądanie stron 238
Section 7. Installation
239
7.8.13.2 String Concatenation
Concatenation is the building of strings from other strings ("abc123"), characters
("a" or chr()), numbers, or variables.
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"
Przeglądanie stron 238
1 2 ... 234 235 236 237 238 239 240 241 242 243 244 ... 565 566

Komentarze do niniejszej Instrukcji

Brak uwag