Converts a numeric string in local format (representable by the user) to machine format dependibg of the indicated language, country and variant.
1 number.parse
<number.parse
lang='lang'
country='country'
variant='variant'
>
<value /> !
</number.parse>
Attributes | |||||
---|---|---|---|---|---|
Name | Type | Required | Default | Description | |
Alang | String | Language used to convert the string to numeric. This code is written in lowercase, with two letters as define the norm ISO-639. A complete list of this codes can be found in several internet sites like this. | |||
Acountry | String | Country used to convert the string to numeric. Different 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 in each browser. For example, WIN is used for WINDOWS, MAC for MACINTOSH and POSIX for POSIX. When exist two variants, they are separated by the underline character '_' and the most important character 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 | String |
Returns | |
---|---|
Type | Description |
String | Numeric value, resulting of parse the string received the indicated language, country and variant. If the value received is null, immediately it will return null as result. |
Exceptions
requires 1 arguments, received: 0
The function needs a entry value.
Unparseable number: "..."
The value passed to the function is impossible to parse, because it contains no numeric characters differents to the comma ',' and the point '.' ..
Example
Conversion of strings which represents numbers, in decimal format, with european and anglo-saxon decimal separator.
Copy
<xsql-script name='number_parse'> <body> <!-- Converts the string 1,2 to a number in german language 1.2 --> <!-- The comma is interpreted in german as decimal separator. --> <println><number.parse lang='de'><string>1,2</string></number.parse></println> <!-- Converts the string 193837.0932 to a number in german language 1938370932 --> <!-- The point is interpreted in german as the thousands separator. --> <println><number.parse lang='de'><string>193837.0932</string></number.parse></println> <!-- Converts the string 1,2 to a number in english language 12 --> <!-- The comma is interpreted in english as the thousands separator. --> <println><number.parse lang='en'><string>1,2</string></number.parse></println> <!-- Converts the string 193837.0932 to a number in english language 193837.0932 --> <!-- The point is interpreted in english as the decimal separator. --> <println><number.parse lang='en'><string>193837.0932</string></number.parse></println> </body> </xsql-script>
Returns:
Copy
1.2 1938370932 12 193837.0932