I think you basically need to convert a number in a 10x number system to a number in a 26x number system.
For instance:
53 = 5 * 10 ^ 1 + 3 * 10 ^ 0 = [5] [3]
53 = B * 26 ^ 1 + A * 26 ^ 0 = [B] [A]
int value10 = 53; int base10 = 10; string value26 = ""; int base26 = 26; int input = value10; while (true) { int mod = input / base26; if (mod > 0) value26 += Map26SymbolByValue10 (mod); // Will map 2 to 'B' else value26 += Map26SymbolByValue10 (input); // Will map 1 to 'A' int rest = input - mod * base26; if (input < base26) break; input = rest; }
user151323
source share