Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert Numbers written as Words to Integers? [duplicate]

Tags:

java

numbers

Is there an open-source Java library for converting String numbers into their equivalent Integers (for example, converting "ten" into 10)? I know how to do it, but I'd rather not waste my customer's time writing one from scratch if there's already a library available.

like image 849
Thomas Schellenberg Avatar asked Sep 25 '12 20:09

Thomas Schellenberg


People also ask

How do I fix the Number stored as text error in Excel?

Next to the selected cell or range of cells, click the error button that appears. On the menu, click Convert to Number. (If you want to simply get rid of the error indicator without converting the number, click Ignore Error.) This action converts the numbers that are stored as text back to numbers.

How do you convert numerical numbers into words?

Use the SpellNumber function in individual cells Type the formula =SpellNumber(A1) into the cell where you want to display a written number, where A1 is the cell containing the number you want to convert. You can also manually type the value like =SpellNumber(22.50). Press Enter to confirm the formula.

Why can't I convert text to numbers in Excel?

On the Tools menu, click Options. In the Options dialog box, click the Error Checking tab. In the Settings section, click to select the Enable background error checking check box. In the Rules section, make sure the Number stored as text rule is selected, and then click OK.


1 Answers

I doubt that such a library exists.

If you're only looking to convert a limited number of numbers(such as zero through ten) than it probably would take you more time to ask this question here than to just implement it yourself.

If you're looking at converting more complex numbers such as "one hundred twenty four and fifty-one hundredth's" than you're looking for is a natural language recognizer, which is extremely complicated, and unlikely to have a good library in any language.

In the end, It's normally best for back end values and user consumable content to not be coupled.

like image 85
Sam I am says Reinstate Monica Avatar answered Sep 25 '22 21:09

Sam I am says Reinstate Monica