Jul 11th, 2005, 10:37 AM
#1
One Hundred Dollars
A class to convert a decimal variable into its spoken word equivalent string...
123.45 converts to "ONE HUNDRED AND TWENTY THREE DOLLARS, FORTY FIVE CENTS". It could be modified to remove the dollars and cents strings.
It can convert numbers in the range 0 to 1.0E+25 inclusive, so no negative numbers please.
Call it like this...
VB Code:
MessageBox.Show(CashToWords.WriteNumberInWords(Decimal.Parse("123.45")))
Its a shared method so there's no need to create an instance of the class first.
Enjoy
Attached Files
I don't live here any more.
Jul 13th, 2005, 10:45 PM
#2
Re: One Hundred Dollars
If you want it in Check format, you would have "ONE HUNDRED AND TWENTY THREE DOLLARS + 45/100", as the cents usually aren't spelled out. I may try to change it on my own
Nice job.
Jul 14th, 2005, 01:32 PM
#3
Re: One Hundred Dollars
Go for it. The post that inspired this wanted the cents in words I think, unless my memory has packed up.
Jul 22nd, 2005, 08:03 AM
#4
Frenzied Member
Re: One Hundred Dollars
Thanks Wossname, I have used this here in the UK by simply ammending the line.
VB Code:
buf.Append("POUNDS, " & cents & " PENCE")
Oct 29th, 2007, 01:34 AM
#5
Addicted Member
Re: One Hundred Dollars
when i copied and pasted it its givin an error as "StringBuilder" is not defined?
Oct 29th, 2007, 04:32 AM
#6
Re: One Hundred Dollars
You have to Import the NameSpace
Code:
System.Text.StringBuilder
Please mark you thread resolved using the Thread Tools as shown
Oct 29th, 2007, 10:42 AM
#7
Re: One Hundred Dollars
I should probably point out that technically it produces the wrong results:
$123.45 = "One Hundred Twenty Three Dollars and Forty Five Cents"
Whereas:
"ONE HUNDRED AND TWENTY THREE DOLLARS, FORTY FIVE CENTS" = "100.$23, $0.45" which isn't a dollar amount at all.
Last edited by JuggaloBrotha; Jun 30th, 2010 at 03:00 PM .
Jan 28th, 2011, 01:54 PM
#8
Addicted Member
Re: One Hundred Dollars
thanks...i was looking for this
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width