Page 1 of 1

Convert Word to Number (ABCD to 0123)

Posted: Sun Mar 15, 2009 11:14 pm
by icecreamsz
Can someone help me, providing Parallel routine for the below format.Any help is highly appreciated thanks!


If any word is given as input , the ouput should be in its corresponding numbers.

Where

(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z)

need to be printed out as

(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25) respectively


For examples
1)

Input =ABCD

Output must be

Output =0123

2)

Input =CAB

Output=201

3)Input = ZEBRA

Output= 2541170

I can also provide server basic routine for this.If anyone can translate that too C++ .I could'nt able to convert.

Thanks a lot in advance

Posted: Sun Mar 15, 2009 11:18 pm
by ray.wurlod
There's no consistent way to decode this. So why is it wanted?
For example 2541170 could decode as ZEBBHA.

Posted: Mon Mar 16, 2009 3:46 am
by Sainath.Srinivasan
A 'for' loop for the length subtracting 'A' from each char is what you need.

Alternatively have 26 replace commands.

You can further simplify this as

outputString = replace('ab...j','0....9',inputField)

and do the rest 16.