Hello,
Does any one here know how to convert numbers to string? example, i input 551 in the text box and the out put will display five hundred fifty one.
Help me...
15 8274
Hello,
Does any one here know how to convert numbers to string? example, i input 551 in the text box and the out put will display five hundred fifty one.
Help me...
DEar I've the code for this but for that u've to wait for some time .........
I'll defenatly give u the code
Trust me
DEar I've the code for this but for that u've to wait for some time .........
I'll defenatly give u the code
Trust me
really?....thnx a lot....looking forward for your reply
really?....thnx a lot....looking forward for your reply
I india its 11.18 am i'm able to give u the code at 2.00pm
is it ok?
I india its 11.18 am i'm able to give u the code at 2.00pm
is it ok?
ooo.... thnx ...it will be ok for me ..... thnx a lot again
Here i am posting the code.this function is for converting Indian Rupees.
I think it will help u - ' This function will work upto 99,99,99,999.99
-
-
Public Function convinRS(Number As Double) As String
-
Dim tempstr As String
-
Dim tempnum As Double
-
Dim convstr As String
-
Dim partlen As Byte
-
Dim ptat As Byte
-
Dim digs As Integer
-
-
-
convstr = ""
-
ptat = InStr(1, CStr(Number), ".")
-
If ptat = 0 Then
-
tempnum = CStr(Number)
-
Else
-
tempnum = Mid(CStr(Number), 1, ptat)
-
End If
-
tempstr = Trim(CStr(tempnum))
-
-
-
While Not tempnum = 0
-
-
partlen = Len(tempstr)
-
Select Case partlen
-
Case Is >= 8
-
digs = CInt(Mid(tempstr, 1, partlen - 7))
-
convstr = diginwrd(digs)
-
If digs > 1 Then
-
convstr = convstr & "Crores "
-
Else
-
convstr = convstr & "Crore "
-
End If
-
tempstr = Right(tempstr, 7)
-
Case Is >= 6 And partlen < 8
-
digs = CInt(Mid(tempstr, 1, partlen - 5))
-
convstr = convstr & diginwrd(digs)
-
If digs > 1 Then
-
convstr = convstr & "Lakhs "
-
Else
-
convstr = convstr & "Lakh "
-
End If
-
tempstr = Right(tempstr, 5)
-
-
Case Is < 6 And partlen >= 4
-
digs = CInt(Mid(tempstr, 1, partlen - 3))
-
convstr = convstr + diginwrd(digs)
-
convstr = convstr & "Thousand "
-
tempstr = Right(tempstr, 3)
-
Case Is <= 3
-
digs = CInt(tempstr)
-
convstr = convstr + diginwrd(digs)
-
tempstr = "0"
-
End Select
-
tempnum = CLng(tempstr)
-
-
'MsgBox tempnum & convstr
-
Wend
-
If ptat = 0 Then
-
tempnum = 0
-
Else
-
tempnum = Val(Right(CStr(Number), Len(CStr(Number)) - ptat + 1)) * 100
-
End If
-
' MsgBox convstr & tempnum
-
convstr = "Rupees " & convstr
-
If Not tempnum = 0 Then
-
convinRS = convstr & "And " & diginwrd(tempnum) & "Paise Only"
-
Else
-
convinRS = convstr & "Only"
-
End If
-
End Function
-
-
Public Function diginwrd(ByVal digsnum As Integer) As String
-
Select Case digsnum
-
Case 1
-
diginwrd = "One "
-
Case 2
-
diginwrd = "Two "
-
Case 3
-
diginwrd = "Three "
-
Case 4
-
diginwrd = "Four "
-
Case 5
-
diginwrd = "Five "
-
Case 6
-
diginwrd = "Six "
-
Case 7
-
diginwrd = "Seven "
-
Case 8
-
diginwrd = "Eight "
-
Case 9
-
diginwrd = "Nine "
-
Case 10
-
diginwrd = "Ten "
-
Case 11
-
diginwrd = "Eleven "
-
Case 12
-
diginwrd = "Twelve "
-
Case 13
-
diginwrd = "Thirteen "
-
Case 14
-
diginwrd = "Fourteen "
-
Case 15
-
diginwrd = "Fifteen "
-
Case 16
-
diginwrd = "Sixteen "
-
Case 17
-
diginwrd = "Seventeen "
-
Case 18
-
diginwrd = "Eighteen "
-
Case 19
-
diginwrd = "Nineteen "
-
Case Is > 19
-
Dim dig As Integer
-
Dim tdigword As String
-
Dim thdig As String
-
dig = CInt(Right(CStr(digsnum), 1))
-
-
If digsnum >= 100 Then
-
thdig = Left(CStr(digsnum), 1)
-
dig = CInt(Right(CStr(digsnum), 2))
-
Else
-
dig = CInt(Right(CStr(digsnum), 1))
-
End If
-
Select Case digsnum
-
Case Is >= 100
-
tdigword = diginwrd(CInt(thdig)) & "Hundred "
-
Case Is >= 90 And digsnum < 100
-
tdigword = "Ninety "
-
Case Is >= 80 And digsnum < 90
-
tdigword = "Eighty "
-
Case Is >= 70 And digsnum < 80
-
tdigword = "Seventy "
-
Case Is >= 60 And digsnum < 70
-
tdigword = "Sixty "
-
Case Is >= 50 And digsnum < 60
-
tdigword = "Fifty "
-
Case Is >= 40 And digsnum < 50
-
tdigword = "Forty "
-
Case Is >= 30 And digsnum < 40
-
tdigword = "Thirty "
-
Case Is >= 20 And digsnum < 30
-
tdigword = "Twenty "
-
End Select
-
diginwrd = tdigword & diginwrd(dig)
-
End Select
-
-
End Function
ooo.... thnx ...it will be ok for me ..... thnx a lot again
the code -
-
Public Function NoToWord(Acceptno As Double) As String
-
NoToWord = ""
-
-
Dim FormatStr As String
-
FormatStr = Format(Acceptno, "000000000.00")
-
-
If Val(mid(FormatStr, 1, 2)) <> 0 Then
-
Call Word(Val(mid(FormatStr, 1, 2)))
-
NoToWord = StrConv(NoToWord & Trim(WordStr) & " CRORE ", vbProperCase)
-
End If
-
If Val(mid(FormatStr, 3, 2)) <> 0 Then
-
Call Word(Val(mid(FormatStr, 3, 2)))
-
NoToWord = StrConv(NoToWord & Trim(WordStr) & " LAC ", vbProperCase)
-
End If
-
If Val(mid(FormatStr, 5, 2)) <> 0 Then
-
Call Word(Val(mid(FormatStr, 5, 2)))
-
NoToWord = StrConv(NoToWord & Trim(WordStr) & " THOUSAND ", vbProperCase)
-
End If
-
If Val(mid(FormatStr, 7, 1)) <> 0 Then
-
Call Word(Val(mid(FormatStr, 7, 1)))
-
NoToWord = StrConv(NoToWord & Trim(WordStr) & " HUNDRED ", vbProperCase)
-
End If
-
If Val(mid(FormatStr, 8, 2)) <> 0 Then
-
Call Word(Val(mid(FormatStr, 8, 2)))
-
NoToWord = StrConv(NoToWord & Trim(WordStr) & " ", vbProperCase)
-
End If
-
If Val(mid(FormatStr, 11, 2)) <> 0 Then
-
Call Word(Val(mid(FormatStr, 11, 2)))
-
If (NoToWord <> "") Then
-
NoToWord = StrConv("Rs. " & NoToWord & "AND " & Trim(WordStr) & " PAISE ONLY", vbProperCase)
-
Else
-
NoToWord = StrConv(NoToWord & Trim(WordStr) & " PAISE ONLY", vbProperCase)
-
End If
-
Else
-
If NoToWord <> "" Then
-
NoToWord = StrConv("Rs. " & NoToWord + " ONLY", vbProperCase)
-
Else
-
NoToWord = "(In Words )"
-
End If
-
End If
-
End Function
-
-
Sub Word(num As Byte)
-
Dim X(9) As String
-
Dim x1(9) As String
-
Dim x2(9) As String
-
-
-
X(1) = "ONE ": X(2) = "TWO ": X(3) = "THREE ": X(4) = "FOUR ": X(5) = "FIVE ": X(6) = "SIX ": X(7) = "SEVEN ": X(8) = "EIGHT ": X(9) = "NINE ":
-
x1(1) = "TEN ": x1(2) = "TWENTY ": x1(3) = "THIRTY ": x1(4) = "FORTY ": x1(5) = "FIFTY ": x1(6) = "SIXTY ": x1(7) = "SEVENTY ": x1(8) = "EIGHTY ": x1(9) = "NINETY ":
-
x2(1) = "ELEVEN ": x2(2) = "TWELVE ": x2(3) = "THIRTEEN ": x2(4) = "FOURTEEN ": x2(5) = "FIFTEEN ": x2(6) = "SIXTEEN ": x2(7) = "SEVENTEEN ": x2(8) = "EIGHTEEN ": x2(9) = "NINETEEN ":
-
-
-
If num <= 9 Then ' for 1 to 9
-
WordStr = X(num)
-
End If
-
If num >= 10 Then ' for 10 to 99
-
If (num Mod 10 = 0) Then ' for 10,20,30....90
-
WordStr = x1(Int(num / 10))
-
End If
-
If (Int(num / 10) = 1 And (num Mod 10 <> 0)) Then 'for 11,12,13.....19
-
WordStr = x2(num Mod 10)
-
End If
-
If (Int(num / 10) > 1 And (num Mod 10 <> 0)) Then ' for 21,22,23.....99
-
WordStr = x1(Int(num / 10)) + X(num Mod 10)
-
End If
-
End If
-
End Sub
-
-
the code is not created by using vb's IDE
so pls check for errors if any
Rs. is Ruppes the Indian Currancy so change it accordingly
I'll not able to answer u later b'coz i'm busy with meetting
bye
The code is created by vb6 and it is working on my machine. the only change in this code is you have to declare one variable (WordStr$) because that i used in two functions. and only thing you want to change is to change the Rs& Paise to your own local currency....
The code is created by vb6 and it is working on my machine. the only change in this code is you have to declare one variable (WordStr$) because that i used in two functions. and only thing you want to change is to change the Rs& Paise to your own local currency....
so do u like d function?
thanx to those who reply. Now i can finish the part... huhu.... love u all.... really hope can help others also, but i'm still newbie wiith all this stuff......
anyway THANX A LOT !!!
the code -
-
Public Function NoToWord(Acceptno As Double) As String
-
NoToWord = ""
-
-
Dim FormatStr As String
-
FormatStr = Format(Acceptno, "000000000.00")
-
-
If Val(mid(FormatStr, 1, 2)) <> 0 Then
-
Call Word(Val(mid(FormatStr, 1, 2)))
-
NoToWord = StrConv(NoToWord & Trim(WordStr) & " CRORE ", vbProperCase)
-
End If
-
If Val(mid(FormatStr, 3, 2)) <> 0 Then
-
Call Word(Val(mid(FormatStr, 3, 2)))
-
NoToWord = StrConv(NoToWord & Trim(WordStr) & " LAC ", vbProperCase)
-
End If
-
If Val(mid(FormatStr, 5, 2)) <> 0 Then
-
Call Word(Val(mid(FormatStr, 5, 2)))
-
NoToWord = StrConv(NoToWord & Trim(WordStr) & " THOUSAND ", vbProperCase)
-
End If
-
If Val(mid(FormatStr, 7, 1)) <> 0 Then
-
Call Word(Val(mid(FormatStr, 7, 1)))
-
NoToWord = StrConv(NoToWord & Trim(WordStr) & " HUNDRED ", vbProperCase)
-
End If
-
If Val(mid(FormatStr, 8, 2)) <> 0 Then
-
Call Word(Val(mid(FormatStr, 8, 2)))
-
NoToWord = StrConv(NoToWord & Trim(WordStr) & " ", vbProperCase)
-
End If
-
If Val(mid(FormatStr, 11, 2)) <> 0 Then
-
Call Word(Val(mid(FormatStr, 11, 2)))
-
If (NoToWord <> "") Then
-
NoToWord = StrConv("Rs. " & NoToWord & "AND " & Trim(WordStr) & " PAISE ONLY", vbProperCase)
-
Else
-
NoToWord = StrConv(NoToWord & Trim(WordStr) & " PAISE ONLY", vbProperCase)
-
End If
-
Else
-
If NoToWord <> "" Then
-
NoToWord = StrConv("Rs. " & NoToWord + " ONLY", vbProperCase)
-
Else
-
NoToWord = "(In Words )"
-
End If
-
End If
-
End Function
-
-
Sub Word(num As Byte)
-
Dim X(9) As String
-
Dim x1(9) As String
-
Dim x2(9) As String
-
-
-
X(1) = "ONE ": X(2) = "TWO ": X(3) = "THREE ": X(4) = "FOUR ": X(5) = "FIVE ": X(6) = "SIX ": X(7) = "SEVEN ": X(8) = "EIGHT ": X(9) = "NINE ":
-
x1(1) = "TEN ": x1(2) = "TWENTY ": x1(3) = "THIRTY ": x1(4) = "FORTY ": x1(5) = "FIFTY ": x1(6) = "SIXTY ": x1(7) = "SEVENTY ": x1(8) = "EIGHTY ": x1(9) = "NINETY ":
-
x2(1) = "ELEVEN ": x2(2) = "TWELVE ": x2(3) = "THIRTEEN ": x2(4) = "FOURTEEN ": x2(5) = "FIFTEEN ": x2(6) = "SIXTEEN ": x2(7) = "SEVENTEEN ": x2(8) = "EIGHTEEN ": x2(9) = "NINETEEN ":
-
-
-
If num <= 9 Then ' for 1 to 9
-
WordStr = X(num)
-
End If
-
If num >= 10 Then ' for 10 to 99
-
If (num Mod 10 = 0) Then ' for 10,20,30....90
-
WordStr = x1(Int(num / 10))
-
End If
-
If (Int(num / 10) = 1 And (num Mod 10 <> 0)) Then 'for 11,12,13.....19
-
WordStr = x2(num Mod 10)
-
End If
-
If (Int(num / 10) > 1 And (num Mod 10 <> 0)) Then ' for 21,22,23.....99
-
WordStr = x1(Int(num / 10)) + X(num Mod 10)
-
End If
-
End If
-
End Sub
-
-
the code is not created by using vb's IDE
so pls check for errors if any
Rs. is Ruppes the Indian Currancy so change it accordingly
I'll not able to answer u later b'coz i'm busy with meetting
bye
Kudos on a great reply. I'd have just left it saying 551 ^.^
Kudos on a great reply. I'd have just left it saying 551 ^.^
would u pls explan 551 pls
would u pls explan 551 pls
Hehe, I would have just left the code as it was, I wouldn't have translated it into words. (This wasn't a very helpful post, just a congrats to the person who solved the problem)
Hi,
I would like to convert 211,11,21,200.00 into Two hundred eleven crores, eleven lakhs, twenty one thousand and two hundred only.
please help
thanks
I would like to convert 211,11,21,200.00 into Two hundred eleven crores, eleven lakhs, twenty one thousand and two hundred only.
Isn't that what the code posted here already does?
By the way, can someone please explain "crores"? I get that a "lakh" is a hundred thousand. Is a "crore" a million, or what?
I would like to convert 211,11,21,200 ...
Something I forgot to ask before, but potentially important. Is this a typo, or does your country group digits this way (3 digits, then 2, then 2, then 3)? If so, this could impact greatly on any code which formats numbers or interprets formatted numbers (or does anything based on calculating the length of formatted numbers). I had always assumed that everyone grouped digits 3 at a time, the way we do (eg. 2,111,121,200) but it certainly wouldn't be the first time I've been wrong.
It's also potentially a very interesting piece of trivia. :)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: aevans1108 |
last post by:
expanding this message to microsoft.public.dotnet.xml
Greetings
Please direct me to the right group if this is an inappropriate place
to post this question. Thanks.
I want to format a...
|
by: Eitan |
last post by:
Hello,
I am looking for a function which convert hebrew string (windows) to hebrew
string (dos).
That's should pay attantion to commas, numbers, and any other character,
that may have problem...
|
by: moondaddy |
last post by:
I'm writing an app in vb.net 1.1 and need to convert a byte array into a
string, and then from a string back to a byte array.
for example
Private mByte() as New Byte(4){11,22,33,44}
Now how...
|
by: FAQ server |
last post by:
-----------------------------------------------------------------------
FAQ Topic - Why does 1+1 equal 11? or How do I convert a string to a number?...
|
by: FAQ server |
last post by:
-----------------------------------------------------------------------
FAQ Topic - How do I convert a Number into a String with exactly 2 decimal places?...
|
by: shellon |
last post by:
Hi all:
I want to convert the float number to sortable integer, like the
function float2rawInt() in java, but I don't know the internal
expression of float, appreciate your help!
|
by: Ron |
last post by:
I want to write a program that will accept a number in a textbox for
example 23578 and then in a label will display the sum of the odd and
even number like this...
the textbox containsthe number...
|
by: =?Utf-8?B?UmljYXJkbyBRdWludGFuaWxsYQ==?= |
last post by:
i need to convert data from string to nibble wich (nibble is a four bits
representation)
As example i have the following code
string data1 = "12345678";
so ¿how can i convert this data...
|
by: Debadatta Mishra |
last post by:
Introduction
In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |