Welcome! Log In Create A New Profile

Advanced

alpha-number convertion

Posted by XmOkEy 
XmOkEy
alpha-number convertion
March 24, 2008 07:07PM
Hi everyone.

I need to convert the alphabet into numbers. A to 1, B to 2, etc.
I cant find a way to do this, can anyone give me some help? Im a C programmer, and in C all its needed its a cast, in here I dont got a clue.

Thanks in advance for some ansewrs!
Fabrice Harari
Re: alpha-number convertion
March 24, 2008 07:48PM
Hi...

the ASC function will give you the ascii code of the character.. You just then have to substract the appropriate value... I don't have my ascii table handy, but it will be something like:
iValue is int
iChar is string
iChar="A"
iValue=asc(iChar)-xx

Best regards

Fabrice Harari
WinDev, WebDev, WinDev Mobile consulting
XmOkEy
Re: alpha-number convertion
March 24, 2008 09:20PM
Thanks you Fabrice, it worked out perfectly:-)
Leo Voet
Re: alpha-number convertion
April 04, 2008 09:24AM
Quote
Fabrice Harari
Hi...

the ASC function will give you the ascii code of the character.. You just then have to substract the appropriate value... I don't have my ascii table handy, but it will be something like:
iValue is int
iChar is string
iChar="A"
iValue=asc(iChar)-xx

Best regards

Fabrice Harari
WinDev, WebDev, WinDev Mobile consulting

If you 'lost' the ascii table, or you forgot to memorise it grinning smiley

iStartvalue is int = Asc("A") - 1
.../...
iValue=asc(iChar)-iStartValue

Always think about sollutions, not about problems.
( quote from a wise man that also quoted : 'Speak, and your mouth will open')
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: