OTX Reference
|
|
Arbitrary number of characters. More...
Public Attributes | |
StringLiteral | init |
Cardinality [0..1] Initialisation of a String declaration with a literal More... | |
Arbitrary number of characters.
A String represents a sequences of characters. The OTX-runtime maps this String to a std::string
class.
Important: Inside the The OTX-runtime the data type
String
handles bytes independently of the encoding used. If used to handle sequences of multi-byte characters (such asUTF-8
), all operations, such as LengthOfString, will still operate in terms of bytes and not the encoded characters! E.g.StringUtil.LengthOfString
("€"); returns 3 and not 1, because "€" consists of 3 bytes inUTF-8
.
Note: If an String declaration is not explicitly initialized, an empty string
""
is assigned to the declaration.
Conversion | Result | Sample |
---|---|---|
ToBoolean | Returns true if string value is "true" , otherwise false | Boolean b = ToBoolean("123"); // Returns false
|
ToInteger | Returns the integer value of the string | Integer i = ToInteger("123"); // Returns 123
|
ToFloat | Returns the float value of the string | Float f = ToFloat("123"); // Returns 123.0
|
ToString | Returns the copy of the value | String s = ToString("123"); // Returns "123"
|
ToByteField | Returns the UTF-8 encoded value | ByteField bf = ToByteField("123"); // Returns 313233
|
StringLiteral OpenTestSystem.Otx.Core.DataTypes.String.init |
Cardinality [0..1]
Initialisation of a String declaration with a literal