473,473 Members | 1,719 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

convert numbers to words Indian system

8 New Member
If any one can can help me out with a function or module to convert numbers to words in the Indian system of numerals..........
Like 1,24,53,432 will read as one crore twenty four lakhs fifty three thousand four hundred and thirty two.
Sep 8 '06 #1
10 10432
PEB
1,418 Recognized Expert Top Contributor
Ehha! The regional settings also can't help you!

And this have to be string!!! And not number!
Sep 8 '06 #2
PEB
1,418 Recognized Expert Top Contributor
So the virgulas are after the first 3 numbers from the right and 2 after each next couple isn't it?
Sep 9 '06 #3
PEB
1,418 Recognized Expert Top Contributor
And this number is it good?

24,86,54,54,421

And when there is a decimals what are you doing? You use the . maybe like this:

24,86,54,54,421.56 ?
Sep 9 '06 #4
bijondhanbad
8 New Member
And this number is it good?

24,86,54,54,421

And when there is a decimals what are you doing? You use the . maybe like this:

24,86,54,54,421.56 ?
-----------------

Yes you are right. A brief intro to the Indian number system is shown below :

Indian numbering system is used today in India, Pakistan, Bangladesh, and Myanmar (Burma) and is based on a unique grouping of 2 decimal places, rather than the 3 decimal places commonplace in the West (China and Japan, for instance, use 4). The terms crore and lakh are in widespread use today in Indian English.
The table below follows the short scale usage of billion being a thousand million. In India, following British usage, the long scale was used, with one billion equivalent to a million million.
India's unique number system
Term Figure No of zeros Western system (short scale)
lakh (lac) 1,00,000 5 100,000 (One hundred thousand)
crore 1,00,00,000 7 10,000,000 (Ten million)
arab 1,00,00,00,000 9 1,000,000,000 (One billion)
kharab 1,00,00,00,00,000 11 100,000,000,000 (One hundred billion)
neel 1,00,00,00,00,00,000 13 10,000,000,000,000 (Ten trillion)
padma 1,00,00,00,00,00,00,000 15 1,000,000,000,000,000 (One
quadrillion)
Sep 10 '06 #5
PEB
1,418 Recognized Expert Top Contributor
-----------------

Yes you are right. A brief intro to the Indian number system is shown below :

Indian numbering system is used today in India, Pakistan, Bangladesh, and Myanmar (Burma) and is based on a unique grouping of 2 decimal places, rather than the 3 decimal places commonplace in the West (China and Japan, for instance, use 4). The terms crore and lakh are in widespread use today in Indian English.
The table below follows the short scale usage of billion being a thousand million. In India, following British usage, the long scale was used, with one billion equivalent to a million million.
India's unique number system
Term Figure No of zeros Western system (short scale)
lakh (lac) 1,00,000 5 100,000 (One hundred thousand)
crore 1,00,00,000 7 10,000,000 (Ten million)
arab 1,00,00,00,000 9 1,000,000,000 (One billion)
kharab 1,00,00,00,00,000 11 100,000,000,000 (One hundred billion)
neel 1,00,00,00,00,00,000 13 10,000,000,000,000 (Ten trillion)
padma 1,00,00,00,00,00,00,000 15 1,000,000,000,000,000 (One
quadrillion)
Ok!
Espessially for you I've wrote this code! Try it and say if it is good! :)

Expand|Select|Wrap|Line Numbers
  1. Function indian_number(my_number) As String
  2. Dim result As String
  3. Dim new_result As String
  4. Dim i As Integer
  5. Dim last_i As Integer
  6. result = my_number
  7. result = Replace(result, ",", ".")
  8. 'Stop
  9. If InStr(1, result, ".") Then
  10.     new_result = Mid(result, InStr(1, result, "."), Len(result) - InStr(1, result, ".") + 1)
  11.     result = Mid(result, 1, InStr(1, result, ".") - 1)
  12. End If
  13.  
  14. For i = 1 To Len(result)
  15.     If (i = 3) And Len(result) > 3 Then
  16.         new_result = "," + Mid(result, Len(result) - 2, Len(result)) + new_result
  17.         last_i = i
  18.     End If
  19.     If (i > 3) And (Len(result) > i) And ((i Mod 2) > 0) Then
  20.         new_result = "," + Mid(result, Len(result) - i + 1, i - last_i) + new_result
  21.         last_i = i
  22.     End If
  23. Next i
  24. new_result = Mid(result, 1, Len(result) - last_i) + new_result
  25. indian_number = new_result
  26. End Function
  27.  
Have a nice day!

:)
Sep 10 '06 #6
PEB
1,418 Recognized Expert Top Contributor
Or you are searching a code that says the numbers with words?

I have mine in bulgarian...

but in English!!!
Sep 10 '06 #7
PEB
1,418 Recognized Expert Top Contributor
IF is it your need I can write you the code but it's difficult and takes as well as 10 -12 hours!

It's better to search in the net!

IF you find a code that says the numbers in English maybe I could retreat it to display the numbers in indian English!

:)
Sep 10 '06 #8
PEB
1,418 Recognized Expert Top Contributor
Type the following code into the module sheet.


Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2.  
  3.       '****************
  4.       ' Main Function *
  5.       '****************
  6.  
  7.       Function SpellNumber(ByVal MyNumber)
  8.           Dim Dollars, Cents, Temp
  9.           Dim DecimalPlace, Count
  10.  
  11.           ReDim Place(9) As String
  12.           Place(2) = " Thousand "
  13.           Place(3) = " Million "
  14.           Place(4) = " Billion "
  15.           Place(5) = " Trillion "
  16.  
  17.           ' String representation of amount.
  18.           MyNumber = Trim(Str(MyNumber))
  19.  
  20.           ' Position of decimal place 0 if none.
  21.           DecimalPlace = InStr(MyNumber, ".")
  22.           ' Convert cents and set MyNumber to dollar amount.
  23.           If DecimalPlace > 0 Then
  24.               Cents = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & _
  25.                   "00", 2))
  26.               MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))
  27.           End If
  28.  
  29.           Count = 1
  30.           Do While MyNumber <> ""
  31.               Temp = GetHundreds(Right(MyNumber, 3))
  32.               If Temp <> "" Then Dollars = Temp & Place(Count) & Dollars
  33.               If Len(MyNumber) > 3 Then
  34.                   MyNumber = Left(MyNumber, Len(MyNumber) - 3)
  35.               Else
  36.                   MyNumber = ""
  37.               End If
  38.               Count = Count + 1
  39.           Loop
  40.  
  41.           Select Case Dollars
  42.               Case ""
  43.                   Dollars = "No Dollars"
  44.               Case "One"
  45.                   Dollars = "One Dollar"
  46.               Case Else
  47.                   Dollars = Dollars & " Dollars"
  48.           End Select
  49.  
  50.           Select Case Cents
  51.               Case ""
  52.                   Cents = " and No Cents"
  53.               Case "One"
  54.                   Cents = " and One Cent"
  55.               Case Else
  56.                   Cents = " and " & Cents & " Cents"
  57.           End Select
  58.  
  59.           SpellNumber = Dollars & Cents
  60.       End Function
  61.  
  62.  
  63.  
  64.       '*******************************************
  65.       ' Converts a number from 100-999 into text *
  66.       '*******************************************
  67.  
  68.       Function GetHundreds(ByVal MyNumber)
  69.           Dim Result As String
  70.  
  71.           If Val(MyNumber) = 0 Then Exit Function
  72.           MyNumber = Right("000" & MyNumber, 3)
  73.  
  74.           ' Convert the hundreds place.
  75.           If Mid(MyNumber, 1, 1) <> "0" Then
  76.               Result = GetDigit(Mid(MyNumber, 1, 1)) & " Hundred "
  77.           End If
  78.  
  79.           ' Convert the tens and ones place.
  80.           If Mid(MyNumber, 2, 1) <> "0" Then
  81.               Result = Result & GetTens(Mid(MyNumber, 2))
  82.           Else
  83.               Result = Result & GetDigit(Mid(MyNumber, 3))
  84.           End If
  85.  
  86.           GetHundreds = Result
  87.       End Function
  88.  
  89.  
  90.  
  91.       '*********************************************
  92.       ' Converts a number from 10 to 99 into text. *
  93.       '*********************************************
  94.  
  95.      Function GetTens(TensText)
  96.           Dim Result As String
  97.  
  98.           Result = ""           ' Null out the temporary function value.
  99.           If Val(Left(TensText, 1)) = 1 Then   ' If value between 10-19...
  100.               Select Case Val(TensText)
  101.                   Case 10: Result = "Ten"
  102.                   Case 11: Result = "Eleven"
  103.                   Case 12: Result = "Twelve"
  104.                   Case 13: Result = "Thirteen"
  105.                   Case 14: Result = "Fourteen"
  106.                   Case 15: Result = "Fifteen"
  107.                   Case 16: Result = "Sixteen"
  108.                   Case 17: Result = "Seventeen"
  109.                   Case 18: Result = "Eighteen"
  110.                   Case 19: Result = "Nineteen"
  111.                   Case Else
  112.               End Select
  113.           Else                                 ' If value between 20-99...
  114.               Select Case Val(Left(TensText, 1))
  115.                   Case 2: Result = "Twenty "
  116.                   Case 3: Result = "Thirty "
  117.                   Case 4: Result = "Forty "
  118.                   Case 5: Result = "Fifty "
  119.                   Case 6: Result = "Sixty "
  120.                   Case 7: Result = "Seventy "
  121.                   Case 8: Result = "Eighty "
  122.                   Case 9: Result = "Ninety "
  123.                   Case Else
  124.               End Select
  125.               Result = Result & GetDigit _
  126.                   (Right(TensText, 1))  ' Retrieve ones place.
  127.           End If
  128.           GetTens = Result
  129.       End Function
  130.  
  131.  
  132.  
  133.  
  134.       '*******************************************
  135.       ' Converts a number from 1 to 9 into text. *
  136.       '*******************************************
  137.  
  138.       Function GetDigit(Digit)
  139.           Select Case Val(Digit)
  140.               Case 1: GetDigit = "One"
  141.               Case 2: GetDigit = "Two"
  142.               Case 3: GetDigit = "Three"
  143.               Case 4: GetDigit = "Four"
  144.               Case 5: GetDigit = "Five"
  145.               Case 6: GetDigit = "Six"
  146.               Case 7: GetDigit = "Seven"
  147.               Case 8: GetDigit = "Eight"
  148.               Case 9: GetDigit = "Nine"
  149.               Case Else: GetDigit = ""
  150.           End Select
  151.       End Function
  152.  
  153.  
So it is easy to change your manner of spelling isn't it?

:)
Sep 10 '06 #9
bijondhanbad
8 New Member
Ok!
Espessially for you I've wrote this code! Try it and say if it is good! :)

Expand|Select|Wrap|Line Numbers
  1. Function indian_number(my_number) As String
  2. Dim result As String
  3. Dim new_result As String
  4. Dim i As Integer
  5. Dim last_i As Integer
  6. result = my_number
  7. result = Replace(result, ",", ".")
  8. 'Stop
  9. If InStr(1, result, ".") Then
  10.     new_result = Mid(result, InStr(1, result, "."), Len(result) - InStr(1, result, ".") + 1)
  11.     result = Mid(result, 1, InStr(1, result, ".") - 1)
  12. End If
  13.  
  14. For i = 1 To Len(result)
  15.     If (i = 3) And Len(result) > 3 Then
  16.         new_result = "," + Mid(result, Len(result) - 2, Len(result)) + new_result
  17.         last_i = i
  18.     End If
  19.     If (i > 3) And (Len(result) > i) And ((i Mod 2) > 0) Then
  20.         new_result = "," + Mid(result, Len(result) - i + 1, i - last_i) + new_result
  21.         last_i = i
  22.     End If
  23. Next i
  24. new_result = Mid(result, 1, Len(result) - last_i) + new_result
  25. indian_number = new_result
  26. End Function
  27.  
Have a nice day!

:)
********************
Sorry, doesn't work.
Any way thanks.
got the code in another site codeproject.com and tip-teks.com
Sep 10 '06 #10
PEB
1,418 Recognized Expert Top Contributor
This code is to vizualize the number like 12.23.65.985
and not to tell you the number in words...

The code bellow is to convert the numbers in words... It is the same as in the others sites...

:)
Sep 10 '06 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Klaus Neuner | last post by:
Hello, I need a function that converts a list into a set of regexes. Like so: string_list = print string_list2regexes(string_list) This should return something like:
2
by: Phil Stanton | last post by:
When designing a new form or report, the Default ForeColor is often something like -2147483640 which is the colour of Windows text (possibly black) and the default backColor is -2147483643...
7
by: Abhishek Jha | last post by:
How can we write a shortest program in c to convert given number to words format. example input 5012 Output: five thousand tewlve.
2
by: egoldthwait | last post by:
I need to convert a 17mb access 2000 db to Oracle and house it in a Citrix farm. The issue: we have never converted an Access Db to Oracle but can probably use Oracle's Workbench to assist with...
5
by: Bob Homes | last post by:
In VB6, foreground and background colors of controls had to be assigned a single number. If you knew the RGB values for the color, you still had to convert them into the single number accepatable...
0
by: bijondhanbad | last post by:
If any one can can help me out with a function or module in MS Access to convert numbers to words in the Indian system of numerals.......... Like 1,24,53,432 will read as one crore twenty four lakhs...
3
by: activeashish | last post by:
my present MYSQL server is storing current time not as an indian time can any one help me in converting this time to indian time either through php or mysql
4
by: mpurnachary | last post by:
Hi... Plz... Help me... I want some code for Converting a Number (money) to Words in Indian Format in C#.NET eg.: if I enter 12345678 then it gives as ... " ONE CRORE TWENTY...
2
by: sandeep2 | last post by:
how to convert the numbers into words in asp.net using c#,please help me,its very urgent....?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.