Convert Number to Text
Verb: convertNumberToText
Converts a number to text according to the Conversion type and the Language selected.
Syntax
convertNumberToText --number(Numeric) --conversiontype(ConversionType) --decimals(Numeric) [--usethousandseparator(Boolean)] [--culture(Culture)] (String)=value
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--number | Number to convert | Required | Number | Number that should be converted. |
--conversiontype | Conversion type | Required | ConversionType | Type of conversion to text. Options:
|
--decimals | Decimal places | Only whenConversion type is SimpleNumber, ExtendedNumber, SimplePercentage, ExtendedPercentage | Number | Number of decimal places to consider after conversion. |
--usethousandseparator | Use thousands separator | Optional | Boolean | Sets whether the result returns with thousands separator. |
--culture | Language | Optional | Culture | Changes the punctuation of the result according to the selected language. Options:
1. Diferentiates a period "." from a comma "," separating the decimal places and the thousand separator. 2. Changes the currency symbol according to language selection. |
Outputs
Script | Designer | AcceptedTypes | Description |
---|---|---|---|
value | Text | Text | Converted text. |
Example
A variable with the value 5.25 is defined, with Conversion type set as "Money" and Language as "English (United States)" to convert this number to text.
defVar --name numberConverted --type String
defVar --name numberToConverter --type Numeric
setVar --name "${numberToConverter}" --value "5.25"
convertNumberToText --number ${numberToConverter} --conversiontype "SimpleMoney" --culture en-US numberConverted=value
logMessage --message "${numberConverted}" --type "Info"
// Result:
// $ 5.25
Remarks
In the Conversion type parameter, if the selected type is "Money", two decimal places are considered for cents. If it is "Number", the parameter Decimal places must be filled, or only the integer part of the value is considered.