toString (I18n - JavaScript)

Produces a string value that represents the value of the number formatted according to the given pattern and according to the conventions of the given locale. If the pattern is missing or null, the number is formatted according to a default format (as in NumberFormat Java class). If the Locale parameter is missing or null, the number is formatted according to the XSP server default locale.

Produces a string value that represents the date formatted according to the given pattern and according to the conventions of the given locale. The pattern may be one of the six predefined patterns represented by i18n constants (DATE_FORMAT, LONG_DATE_FORMAT, etc. )

These patterns are localizable : the exact format changes depending on the locale. The pattern may also be an explicit pattern ('dd/MM/yyyy'). This kind of pattern is not impacted by the locale. (except if the pattern contains MMMM for the name of the month, or EEE for the name of the day in week : the name is displayed in the right language. ) If the pattern is missing or null, the date id formatted by using the format. If the Locale parameter is missing or null, the string is interpreted according to the XSP server default locale.

Defined in

I18n

Syntax

toString(number:double, pattern:string, valueIfZero:string, loc:Locale) : string

toString(number:double, pattern:string, valueIfZero:string) : string

toString(number:double, pattern:string, loc:Locale) : string

toString(number:double, pattern:string) : string

toString(number:double, loc:Locale) : string

toString(number:double) : string

toString(date:Date, pattern:string, loc:Locale) : string

toString(date:Date, pattern:string) : string

toString(date:Date, loc:Locale) : string

toString(date:Date) : string

Parameters Description
number Value of the number.
pattern The pattern that 'date' is supposed to match.
valueIfZero Zero value.
loc The locale used to translate a predefined pattern ( means M/d/yy in US).
Return value Description
string String value used to represent the string produced from the formatting values passed.