View Single Post
 
Old 03-11-2007, 01:35 AM
asmdev asmdev is offline
Member
 
Join Date: Dec 2005
Posts: 68
asmdev is on a distinguished road
here is another version

string s="GBPUSD", magicStr = "";
int len = StringLen(s), tmp;
for(int i=0; i<len; i++){
tmp = StringGetChar(s, i);
magicStr = magicStr+(tmp-64);
}
int magic = StrToInteger(magicStr);

64 was subtracted under assumption that symbol is ascii string
Without -64 the resulting # will not fit into int type resulting in negative #, i dont know if thats ok and if number is unique.
I dont know if subtracting 64 for other pair other than g/u gives small number.

Anyway this was intended for you to think and try writing the function yourself.