Strings are a plain sequence of alphanumerical characters -
letters, numbers or symbols - which are mostly used for messages, or for identifiers of objects such as projects (documents), actions, buffers, programmers (end devices), etc.
They are defined this way:
string name = "characters";
string with the given name and initializes it to the content characters between
double quotation marks.
- Special characters in the string can be given with a backslash: \n = Line feed, \" = double quote, \\ = back slash.
- Strings can be compared with the == operator, f.i. if (sDocument == "document0") ...
- Strings can be concatenated with the +, += operators, f.i. string s = "Hello " + "World";
- Strings can be repeated with the *, *= operators, f.i. string s = "Hello " * 2;
- Arrays of strings can be defined just as arrays of variables.
string device_name = "device";
string empty_str = "";
The string class has the following functions:
returns the number of characters in the string.
returns the integer number represented by the string.
returns the double floating point number represented by the string.
Strings can be formatted with the message function and the << pipe operator. The content between %..% is replaced by the pipe in order of appearance, e.g:
message("Variable %p1% has the content %p2%") << "Test" << 12;
// results in the string "Variable Test has the content 12"
Variables, structs, functions, print, message