Community Central
Community Central
Forums: Index Support Requests Number to text
Fandom's forums are a place for the community to help other members.
To contact staff directly or to report bugs, please use Special:Contact.
Archive
Note: This topic has been unedited for 4357 days. It is considered archived - the discussion is over. Information in this thread may be out of date. Do not add to unless it really needs a response.


Can anyone build me a template to convert numbers into text format. For example, changing '65' to 'sixty-fifth'. I only need up to one hundred (but any more would be great!) Cheers.    ǝsʞpɐןǝ  (message wall)  13:48, 14/05/2012

Anyone?    ǝsʞpɐןǝ  (message wall)  17:57, 14/05/2012
Does it have to be so complicated? Wouldn't "1st", "2nd", "65th", "423rd" be enough? --  pecoes  18:21, May 14, 2012 (UTC) 
I already have a template which does that. I am specifically looking for a worded version, as I am using a template to write the introductory paragraph.    ǝsʞpɐןǝ  (message wall)  19:16, 14/05/2012

It doesn't sound terribly hard, but I need to know a bit more context. How exactly are you going to be using it? Sounds like a simple #switch: job, though. It's actually harder to go the other way, i.e. from 10th (or tenth) to 10.

Without additional context I'd say it would go something like this:

{{#switch:{{{number}}}
|1=one
|2=two
|3=three
...
|100=one hundred
}}

I don't know your coding expertise, so I'll explain that this is saying, "take the value of the variable indicated by {{{number}}} and convert it to a word based upon whatever that value is". So if you named this template {{convert}}, and you had a variable nambed {{{number}}} already in an infobox or template, then you would type {{convert|{{{number}}}}}} and it would work perfectly. But, again, I don't know what you're doing with it. czechout    fly tardis  19:50: Mon 14 May 2012 

Post a link to your ordinal number template, please! Who knows - maybe can throw something together really quickly by adding a switch like the one CzechOut suggested to it...
 pecoes  20:02, May 14, 2012 (UTC) 
Cheers CzechOut. My coding is very good, but I was thinking too compicated. I didn't even consider that a switch with every number would be good.
Pecoes, my ordinal template is at w:c:eladkse:Template:Ordinal, but I don't think you need it now.    ǝsʞpɐןǝ  (message wall)  21:33, 14/05/2012