-
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]
-
So what exactly are you after?
£100.00 = One Hundred
£101.12 = One Hundred and One point Twelve
-
you need to conver a number to a string? or what do you mean?
use cstr to convert a variable to string
-
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)
-
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