Jump to content

Number to text


This topic is 7817 days old. Please don't post here. Open a new topic instead.

Recommended Posts

This is a big job because it all has to be hard-coded in. Because it's hard-coded it will have a limit to the maximum number it will process.

I think (not sure) that there is a calculation that does this at http://www.databasepros.com in the tips section or something.

Link to comment
Share on other sites

I have done this for numbers up to 999,999,999. I found the best tradeoff between complexity and effort is to use a combination of calculations and a related file that holds the text version of numbers from 1 to 99.

Break the number into groups of 3 digits. The first group is millions; the second group is thousands, and the last is units. Each of these is then broken into sub-groups consisting of the first digit, and the last two digits. This gives a total of 6 sub-groups. Create six relationships between the main file and the text lookup file based on each of these sub-group values.

Each group is processed the same way. If a group is > 99 then lookup the text equivalent for the first digit and append "hundred" then lookup and concatenate the text for the last two digits. If the group value is zero, the resulting text should be an empty string.

For the first group, if the string is not empty, append "million "

For the second group, if the string is not empty, append "thousand "

Finally, concatenate all strings together.

Link to comment
Share on other sites

  • 2 weeks later...

Thanks a lot I found a lot of useful tip .

quote:

Originally posted by Vaughan:

This is a big job because it all has to be hard-coded in. Because it's hard-coded it will have a limit to the maximum number it will process.

I think (not sure) that there is a calculation that does this at
in the tips section or something.

Link to comment
Share on other sites

This topic is 7817 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.