Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: number to words Post Reply Post New Topic
Author Message
frankie
Newbie
Newbie


Joined: 31 Jan 2008
Location: Australia
Online Status: Offline
Posts: 2
Quote frankie Replybullet Topic: number to words
     Posted: 31 Jan 2008 at 2:49pm
Hi,
 
I am facing a problem of converting numbers into words/english. The function ToWords() doesn't do what i need to do. for example, the value 135, ToWords function will translates into "one hundred thrity-five". But i want "one hundred and thirty-five".  Is there anyway i can achieve it?
 
Thanks
Frankie
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 31 Jan 2008 at 3:05pm
Can you insert the "and" yourself by parsing out the string and concatenating it in?
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
frankie
Newbie
Newbie


Joined: 31 Jan 2008
Location: Australia
Online Status: Offline
Posts: 2
Quote frankie Replybullet Posted: 07 Feb 2008 at 2:31pm
how do i know where should i put the "and"?  the value is changing all the time
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 07 Feb 2008 at 2:47pm
I would put it right before the last word in the string. Then test it to see what exceptions cause it not to work and add some if-then statements to account for these exceptions. And I would test the string first to make sure it includes the word "hundred" or "thousand" in it to see if "and" is necessary or not.


Edited by BrianBischof - 07 Feb 2008 at 2:48pm
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum