Extensions.Util.StringFormat

From emotive
Revision as of 05:20, 8 November 2018 by Hb (talk | contribs)
Jump to navigation Jump to search

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.

Icons Note.png 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.
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

/// Local Declarations

String String1;
String Locale = "";

/// Flow

Locale = I18n.GetCurrentLocale();
String1 = Util.StringFormat("{0} Peter\n{0} {1} {0}", Locale, {"Hello", "Klaus"});

See also

Compare
CopyByteField
GetRandomNumber
IsInitialized
ListIndexOf
ListIndexOfAny
ListReverse
ListSort
Max
Min