Converts a number to the indicated format (display format) and returns the resulting string. There is several forms to indicate the format:
- If format is indicated, it takes the defined format.
- If format is not indicated and locale is indicated, it takes the format based in a locale obtained for a country and variant.
- If locale is not indicated, it uses the format of the user local.
1 number.format
<number.format
format='format'
maximumfractiondigits='maximumfractiondigits'
minimumfractiondigits='minimumfractiondigits'
lang='lang'
country='country'
variant='variant'
>
<value /> !
</number.format>
Attributes | |||||
---|---|---|---|---|---|
Name | Type | Required | Default | Description | |
Aformat | String |
Format to which you should convert the number passed as argument to the function. |
|||
Amaximumfractiondigits | Integer | Minimum number of decimal digits which should be used to represent the number. | |||
Aminimumfractiondigits | Integer | Maximum number of decimal digits which should be used to represent the number. | |||
Alang | String | Language used to convert the string to numeric. This code is writted in lowercase, with two letters as defines the norm ISO-639. You can found a complete list of this codes in several internet sites like this. | |||
Acountry | String | Country used to convert the string to numeric. Differents countries which uses a same language can have different numeric representations. This code is written in lowercase, with two letters as defines the norm ISO-3166. A complete list with this codes can be found in several internet sites like this. | |||
Avariant | String | The variant is specific of each browser. For example, WIN is used for WINDOWS, MAC for MACINTOSH an POSIX for POSIX. When there is two variants, they are separated with the sublined character '_'and the most imported is placed at the beginning. For example a traditional spanish collation could built a locale with parameters for the language, country and variant as: "es", "ES", "Traditional_WIN". |
Arguments | |||||
---|---|---|---|---|---|
Name | Type | Required | Unique | Nullable | Description |
Evalue | Number |
Returns | |
---|---|
Type | Description |
number | If the received value is null, immediately it will return null as result. |
Special characters of format: | ||
---|---|---|
Symbol | Location | Description |
0 | Número | Dígito. |
# | Número | Dígito, los ceros no relevantes no se muestran. |
. | Number | Decimal separator. |
- | Number | Minus. |
, | Number | Separator of groups or blocks of digits. |
E | Number | Separate the mantissa of the exponent in scientific notation. |
; | Subpattern limit | Separate positives and negatives subpatterns. |
% | Prefix or suffix | Multiply by 100 and it is shown as a percentage. |
\u2030 | Prefix or suffix | Multiply by 1000 and it is shown as per thousand. |
' | Prefix or suffix | It is used to place in inverted commas special characters in the prefix or suffix , for example "'#'#" format 123 as "#123". To indicate a simple quote sign as it is, two characters should be used, for example "# or''clock". |
Exceptions
requires 1 arguments, received: 0
The function needs a entry value.
invalid number "..."
The value passed to the function is impossible to format since it is not a numeric value because it does not contain no numerical characters differents to the comma ',' and the point '.'...
user must be set for operations
An user is required to obtain its locale, in the case of not indicated format or language.
Converts a number to the format "###,###.####", with 2 decimals. The number 987410 is represented according to this format and 2 decimals as 987,410.00.
<xsql-script name='number_format_sample1'> <body> <println> <number.format format='###,###.####' maximumfractiondigits='2' minimumfractiondigits='2'> 987410 </number.format> </println> </body> </xsql-script>
Returns:
987,410.00
1.1 number.intValue
Returns the number in Integer format. It is useful to obtain the integer of a decimal for example.
<number.intValue>
<number /> +
</number.intValue>
Arguments | |||||
---|---|---|---|---|---|
Name | Type | Required | Unique | Nullable | Description |
Enumber |
Returns | |
---|---|
Type | Description |
int | Return the integer part of the number. |
The integer part of the number. In the example, the decimal value 83938.9383 will be obtained the integer number 83938.
<xsql-script name='number_intValue'> <body> <println> <number.intValue> <number>83938.9383</number> </number.intValue> </println> </body> </xsql-script>
Returns:
83938