Choose where you’d like to start

toWords()

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)

<variabletoWords(<number><language>);
ParameterData typeDescription
<variable>TEXTThe variable that will contain the converted into words.
<number>NUMBER/ DECIMAL

The input number that will be converted into words.

Note:
  • A number input value can contain up to 18 digits.
  • The whole and decimal parts of a decimal input value can collectively be up to 15 digits.
<language>NUMBER/ TEXT

The language in which the input number will be converted into words.

Supported Languages:

  • English UK: en-gb
  • English US: en-us
  • French: fr
  • German: de
  • Italian: it
  • Japanese: ja
  • Korean: ko
  • Chinese: zh
  • English Indian: en-in

 

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 


Get Started Now

Execute