|
-
Jun 28th, 2000, 10:18 PM
#1
Thread Starter
Addicted Member
I did a search on vb-world for a NUMBER TO WORD function and found two... but gess what.... they don't work because I have a decimal point. (this is for currency)
Is there anyone out there that has such a function?
[Edited by David Laplante on 06-29-2000 at 11:20 AM]
-
Jun 28th, 2000, 10:35 PM
#2
Fanatic Member
So what exactly are you after?
£100.00 = One Hundred
£101.12 = One Hundred and One point Twelve
Iain, thats with an i by the way!
-
Jun 28th, 2000, 10:36 PM
#3
transcendental analytic
you need to conver a number to a string? or what do you mean?
use cstr to convert a variable to string
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jun 28th, 2000, 10:40 PM
#4
Frenzied Member
Why not call the NUMBER->WORD function twice, once with the number in front of the decimal point, and then again with the number after the decimal point;
eg;
Code:
Dim MyNumber as Double
Dim TempString As String
Dim ResultString As String
Dim FindPoint As Integer
ResultString=""
TempString=Cstr(MyNumber)
FindPoint=Instr(TempString,".")
If FindPoint=0 Then
ResultString=NumberToWords(Cint(MyNumber))
Else
ResultString=NumberToWords(CInt(Left(TempString,FindPoint-1)))
ResultString=ResultString+" point "
ResultString=ResultString+NumberToWords(Cint(Right(TempString,Len(TempString)-FindPoint))
End If
If the NumberToWords function you are using doesn't accept Integers, change the CINTs to the appropriate conversion function (eg Clng - LONG, Cdbl - DOUBLE etc)
'Buzby'
Visual Basic Developer
"I'm moving to Theory. Everything works there."
-
Jun 28th, 2000, 11:10 PM
#5
New Member
http://www.mvps.org/vbnet/code/helpers/numbertotext.htm
I found the aforementioned site yesterday. I believe that is a very thorough NUMBER to WORD routine. It includes the ability to convert monetary and decimal values into their "verbal" format. i.e. $1.30 as in One Dollar and Thirty Cents.
Good Luck
Tom
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
|