Hi!!!!
how can I convert words into numerals...In first textbox i enter word and on button click equivalent numeral is displayed in another textbox
for Example we enter "One crore twenty lakh thirty four thousand seven hundred eighty four" ,
then its corresponding numeral should be "12034784".

What will be the C# code for finding corresponding numerals for range 0 to 999999999 .....
I mean kindly give me general code applicable for all values.........

Recommended Answers

All 11 Replies

This discusses the problems you are likely to encounter depending on the language. Have fun!

commented: Very informative but who cares. FR.OM NUMBERS TO NUMERALS AND VICE VERSA +10

yaa its similar but that code hasn't solved my problem..........
I dont know pythoc and my problem is not yet solved

I dont think any one will give you complete code. You first try your self and then ask question, if you face any problem.

The solution adatapost has given in mentioned post, is a way to solve the problem, you can extend it.

The Python solution is also a hint for you, you can take the algorithm and solve it in C#.

I dont think any one will give you complete code. You first try your self and then ask question, if you face any problem.

The solution adatapost has given in mentioned post, is a way to solve the problem, you can extend it.

The Python solution is also a hint for you, you can take the algorithm and solve it in C#.

i could not understand the logic ,then how can i start............

i could not understand the logic ,then how can i start............

Start by providing a portion of code logic that you don't understand and we will try to explain so you will understand it.

Did you read the suggested link I gave you in my post #2?
My guess: you didn't;)
Read it or don't. But then consult the grammar of your language of choice and see how numbers are formed in words.
This will be a set of rules(and some exceptions...) and start from there.
Start simple: if you encounter the string "one" in a string, how would you translate that?
If that is working, build up from there.

I have made a code in which i used the concept of hash table.....
In that , if i enter words without spaces like"tenthousand" or "minus ten thousand" , its giving zero......
i want that in first case it should give message as"enter words with proper spacing" and in second case it should give "-10000".....

What can i do for this

Well, start sending us some code.
Point out where the problem is.
How would you like us to solve your problem? Looking at tea leaves?

In that , if i enter words without spaces like"tenthousand" or "minus ten thousand" , its giving zero......
i want that in first case it should give message as"enter words with proper spacing" and in second case it should give "-10000".....

What can i do for this

I am fresh out of tea leaves, but here is a couple of suggestions:
1) instead of trying to determine the user left out a space, just report the string that could not be understood and give them a list of reasons why it might have happened:
...possibly because:
- missing space between words
- ...(another reason),
- etc.
...proper usage is: "..." -- tell the user how to use it and give good examples, and, perhaps, some invalid entries for examples of what not to input.
2) If you are able to translate 10000, then you can probably figure out that you just need to add "minus" to your search/hash table if you really want to allow the usage of the word "minus" for -10000; otherwise, resort to suggestion 1 as a catchall--recommended.

Thanks buddies..............

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.