OTX Reference  
OpenTestSystem.Otx.Core.DataTypes.String Class Reference

Arbitrary number of characters. More...

Inheritance diagram for OpenTestSystem.Otx.Core.DataTypes.String:
Inheritance graph

Public Attributes

StringLiteral init
 Cardinality [0..1]
Initialisation of a String declaration with a literal More...
 

Detailed Description

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 as UTF-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 in UTF-8.

Note: If an String declaration is not explicitly initialized, an empty string "" is assigned to the declaration.

Terms and Actions
List of some useful terms and actions:.
Conversion Terms
ConversionResultSample
ToBooleanReturns true if string value is "true", otherwise false
Boolean b = ToBoolean("123"); // Returns false
ToIntegerReturns the integer value of the string
Integer i = ToInteger("123"); // Returns 123
ToFloatReturns the float value of the string
Float f = ToFloat("123"); // Returns 123.0
ToStringReturns the copy of the value
String s = ToString("123"); // Returns "123"
ToByteFieldReturns the UTF-8 encoded value
ByteField bf = ToByteField("123"); // Returns 313233
Syntax Declaration
String Declaration [= StringLiteral];
Literal
"Hello World"
"Line\nbreak"
Sample
String StringVariable = "Hello World";

Member Data Documentation

◆ init

StringLiteral OpenTestSystem.Otx.Core.DataTypes.String.init

Cardinality [0..1]
Initialisation of a String declaration with a literal