StringLib.format function

StringLib.format accepts a non-string value and a pattern and returns the corresponding string.

Package

eglx.lang

Syntax
static function format(intValue smallint in, pattern string in) returns (string);

static function format(intValue int in, pattern string in) returns (string);

static function format(intValue bigint in, pattern string in) returns (string);

static function format(decValue decimal in, pattern string in) returns (string);

static function format(floatValue smallfloat in, pattern string in) returns (string);

static function format(floatValue float in, pattern string in) returns (string);

static function format(d date in, pattern string in) returns(string);

static function format(ts timestamp in, pattern string in) returns(string);
intValue, decValue, floatValue, d, ts
Takes the value to be formatted.
pattern
A pattern that is composed of the characters listed in “Pattern characters used to format non-string values to strings.” If you are formatting dates or timestamps, you can also use one of the patterns that are in the Constants system library.

If the pattern cannot be used to format the specified value, the function returns a string of asterisks.

Example use

After the following code runs, the value of result is in the European format, “07.04.2030”:

myDate Date = "04/07/2030";
result String = StringLib.format(myDate, Constants.eurDateFormat);
Comments
Compatibility

Table 1. Compatibility
Target Issue
Java No issues.
JavaScript No issues.