I need some code in my program which takes a number as input and converts it into corresponding text e.g. 745 to "seven hundred forty five".
Now, I can write code for this, but is there any library or existing code I can use?
I need some code in my program which takes a number as input and converts it into corresponding text e.g. 745 to "seven hundred forty five".
Now, I can write code for this, but is there any library or existing code I can use?
You need to look at this stackoverflow question
From the above-mentioned link:
perl -MNumber::Spell -e 'print spell_number(2);'
From perldoc of Lingua::EN::Numbers:
use Lingua::EN::Numbers qw(num2en num2en_ordinal);
my $x = 234;
my $y = 54;
print "You have ", num2en($x), " things to do today!\n";
print "You will stop caring after the ", num2en_ordinal($y), ".\n";
prints:
You have two hundred and thirty-four things to do today!
You will stop caring after the fifty-fourth.