Campbell-scientific CR9000X Measurement and Control System Manual de usuario Pagina 397

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 442
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 396
Section 11. String Functions
11.1 Expressions with Strings
11.1.1 Constant Strings
Fixed (constant) strings can be used in expressions using quotation marks “”.
For example, FirstName = “Mike” causes the string variable FirstName to be
assigned “Mike”.
11.1.2 Add Strings
Strings can be concatenated using the ‘+’ operator or the ‘&’ operator.
If you need to concatenate strings and variables, use the ‘+’ operator.
When using the ‘&’ operator, the values being concatenated must be strings
(integers will be converted to strings). When working strictly with strings the
‘&’ operator can be safer to use than the ‘+’ operator, because with the ‘&’
operator there is no danger of a value being converted from a string to an
integer.
Example FullName = FirstName + “ “ + MiddleName + “ “ + LastName
FullName = FirstName & “ “ & MiddleName & “ “ & LastName
(The “ “ puts a space between the names.)
11.1.3 Subtraction of Strings
String1-String2 results in an integer in the range of –255..+255. Starting with
the first character in each string, the characters in string2 is subtracted from the
character in string1 until the difference is non-zero or until the end of each
string is reached. This is mainly used to determine if the strings are the same
or not.
11.1.4 String Conversion to/from Numeric
Conversion of Strings to Numeric and Numeric to Strings is done
automatically when an assignment is made from a string to a numeric or a
numeric to a string, if possible.
For example:
Public Value ‘ default, a IEEE4 float
Public SensorString AS String * 8 ‘an ASCII reading from a sensor
Value = SensorString * 1.8 + 32 ‘Sensor string is converted to the IEEE4
Value and scaled from Celsius to Fahrenheit.
11-1
Vista de pagina 396
1 2 ... 392 393 394 395 396 397 398 399 400 401 402 ... 441 442

Comentarios a estos manuales

Sin comentarios