Extensions.Util.StringFormat
Contents
Classification
Name | StringFormat |
Short Description | Converts the given terms to format specified strings |
Class | Term |
Extension | OTX Util extension |
Group | Util related terms |
Exceptions | StringFormatException |
Checker Rules | - |
Standard Compliant | Yes |
OTL Syntax
StringTerm = Util.StringFormat(StringTerm format, StringTerm locale, { SimpleTerm[] argument });
Description
The OTX StringFormat term converts the given terms to format specified strings and inserts them into another string.
Return Value
The Term returns the value, see table below.
In OTX, Terms are categorized according to its return data type!
Data Type | Description |
String | The string is created from the given terms and format specified strings. |
Properties
Name | Data Type | Class | Default | Cardinality | Description |
Format | String | Term | - | [1..1] | The format is a StringTerm that can contain one or more format specifiers. The opening and closing curly braces are special characters and will only be used for defining format specifiers within the string. If the curly braces are used incorrectly, a StringFormatException is thrown. In the format string supports the following escape codes:
In case no conversion is defined the default conversion is String. If the conversion does not fit the given term a StringFormatException is thrown.
|
Locale | String | Term | - | [0..1] | The locale to apply during formatting. The format is identical to that used in i18n:GetCurrentLocale. If the locale is not given, empty or not supported, the default locale of the runtime system is taken. The current language can be identified by calling i18n:GetCurrentLocale. |
Argument | Simple | Term | - | [0..*] | Arguments referenced by the format specifiers in the format string. If there are more arguments than format specifiers, the extra arguments are ignored. The number of arguments is variable and may be zero. If more identical format specifiers are used in the format string, the appropriate arguments are inserted multiple.
The maximum number of arguments is limited of resources of the used run time system. A recommendation is not to use more than 10 arguments. |
OTL Examples
String String1;
String Locale = "";
/// Flow
Locale = I18n.GetCurrentLocale();
// Result: String1 = "Hello Peter, Hello Klaus Hello"
String1 = Util.StringFormat("{0} Peter, {0} {1} {0}", Locale, {"Hello", "Klaus"});
See also
Compare
CopyByteField
GetRandomNumber
IsInitialized
ListIndexOf
ListIndexOfAny
ListReverse
ListSort
Max
Min