Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conversion.... Num to Char.

Status
Not open for further replies.

slurpyx

Programmer
Aug 1, 2002
59
PH
I am a newbie programmer and i am writing a very small check writing software for my grandmother. Well i have seen a lot of check writing software out ther and i want to know on how they convert 1000 to One Thousand, 12340 to Twelve Thousand and Three Hundred Fourty....

Thank you.
 
lnNumberToTranslate = 12345
lnDivider = 10

Divide your number to 10 depending how big it is. ( while lnNumberToTranslate > 0 ). After a division MOD(lnNumberToTranslate, 10) you gonna get the remainder. if it's your first division then that remainder it's zecimal and so on. Before you made the next division make lnNumberToTranslate smaller

I. 12345
II. 1234

Or leave him alone and increase the lnDivider (10, 100).
The rest is simple. Two procs with do case structures:

I. case tnParam = 1
return "One"

II. case tnParam = 100
return "Hundred"

Hope this helps !!!
Thanks for sharing your knowlege.
 
Go to the UT at click the Downloads picture on the Left, choose Visual FoxPro, then enter "words" (without the quotes) in the Summary box and press enter. You should get back four or five variants on a routine to do this. (Including in French and Turkish!)

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top