Forum:Number to text

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.


 * Anyone?


 * Does it have to be so complicated? Wouldn't "1st", "2nd", "65th", "423rd" be enough? --


 * 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.

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: I don't know your coding expertise, so I'll explain that this is saying, "take the value of the variable indicated by and convert it to a word based upon whatever that value is". So if you named this template, and you had a variable nambed already in an infobox or template, then you would type } and it would work perfectly. But, again, I don't know what you're doing with it. 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...


 * 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.


 * A not-so-smart idea came to mind.. What about this?


 * If you want this for 100+




 * would work up to 199. If you'd like to limit usage to 199, wrap the code with . By the way how to verify if the value is a natural number..? :S hm...
 * Hmm... I'll have to look into the natural number bit, as I'll need to add it to my original template. Your code is closer to the one I originally wanted, but encounters the same problem which confused me to start with - how to get the correct ordinal all of the time. I think the basic switch will probably be the best way in te end, as it means less work.
 * It was a source for cardinal numbers so it could have some trouble if we change every parameter into ordinal ones. Anyway, if you need it for only 1 to 100, I also find #switch way simpler.
 * I got the idea for natural number issue.  I just ran a test and it worked fine.