toWords()
Table of Contents
Overview
The toWords() function converts the input number into words. For example, if 1000 is given as input number, the output will be returned as "one thousand".
Return Type
Syntax
<variable> = <number>.toWords(<language>);
(OR)
<variable> = toWords(<number>, <language>);
Parameter | Data type | Description |
<variable> | TEXT | The variable that will contain the converted into words. |
<number> | NUMBER/ DECIMAL | The input number that will be converted into words. Note:
|
<language> | NUMBER/ TEXT | The language in which the input number will be converted into words. Supported Languages:
|
Examples
whole_number = 1989; info whole_number.toWords("en-us"); // returns one thousand nine hundred eighty-nine decimal_number = 1989.13; info decimal_number.toWords("en-us"); // returns one thousand nine hundred eighty-nine point one three negative_number = -12; info negative_number.toWords("en-gb"); // returns minus twelve to_korean = 24; info to_korean.toWords("ko"); // returns 이십사 whole_number = 10000000; info whole_number.toWords("en-gb"); // returns ten million whole_number = 10000000; info whole_number.toWords("en-in"); // returns one crore
whole_number = 1989; info whole_number.toWords("es");; // returns mil novecientos ochenta y nueve