Specifications

11-1
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. For example, 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 character 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.
Example: Tag an ID onto the end of a list of names:
Dim ID AS long
Public Names(10) AS STRING * 16
For ID = 1 to 10
Names(ID) = “ITEM”+ID
Next ID
The array of Names(10) becomes “ITEM1”, “ITEM2”,…,”ITEM10”