LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 09-01-2004, 10:03 AM   #1
lackluster
Member
 
Registered: Apr 2002
Location: D.C - USA
Distribution: slackware-current
Posts: 488

Rep: Reputation: 30
Textual representation of numbers


I'm sure somebody somewhere must have asked this, but I cannot for the life of me find this information anywhere online. Perhaps I'm just searching wrong. Anyways, I was wondering if anyone had or knew of a function, preferably in PHP, that would give back a numerical representation of a number. Something like:

Code:
<?php 
$number = 12;
$text = textual_representation($number);
print $text;
?>
Would give something like "Twelve".

I'm sure this wouldn't be too terribly difficult to invent, but if it's already there, that would be great.
 
Old 09-01-2004, 10:39 AM   #2
scissors
Member
 
Registered: Aug 2004
Location: Seattle
Distribution: Red Hat es and as, Solaris, Fedora, Debian, Tru64
Posts: 45

Rep: Reputation: 15
I don't know about doing it in php, but you can in perl, using the Number::Spell module.
 
Old 09-01-2004, 10:56 AM   #3
lackluster
Member
 
Registered: Apr 2002
Location: D.C - USA
Distribution: slackware-current
Posts: 488

Original Poster
Rep: Reputation: 30
That should be easy enough to convert. Thanks!
 
Old 09-05-2004, 03:05 PM   #4
lackluster
Member
 
Registered: Apr 2002
Location: D.C - USA
Distribution: slackware-current
Posts: 488

Original Poster
Rep: Reputation: 30
I barely modified it. This was the easiest conversion ever. It took less than 30 minutes (I did, being the american scum that I am, leave out the european formatting): http://lackluster.tzo.com:1024/NumberSpell.php.txt
 
Old 09-05-2004, 04:02 PM   #5
Proud
Senior Member
 
Registered: Dec 2002
Location: England
Distribution: Used to use Mandrake/Mandriva
Posts: 2,794

Rep: Reputation: 116Reputation: 116
Cool. Could you submit it to a more perminant place on the web, or to the PHP developers maybe?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
USB Device Representation in Linux BobCap Programming 1 10-12-2005 08:51 PM
representation of binary tree using array sajith Programming 3 10-06-2005 10:59 PM
Adding numbers, break on non-numbers... Cruger Programming 1 03-22-2004 09:18 AM
Killing all X applications from login screen and going to textual mode e-regular Linux - General 4 10-19-2003 10:26 AM
startx won't start - goes back to textual login - what to do?? e-regular Linux - Newbie 2 09-10-2003 11:21 AM


All times are GMT -5. The time now is 08:23 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration