The problem you describe is harder than just converting a base26 representation to an integer, doing some calculation, and then converting back. Your alpha strings aren't necessarily base26. For example, you say that given AA and CD , you want to generate
AA, AB, AC, AD
BA, BB, BC, BD
CA, CB, CC, CD
What you really have is a base4 system that uses the characters A , B , C , and D to represent the numbers 0 , 1 , 2 , and 3 . What you're saying here is that you want to generate all the 2digit, base4 numbers from 00 through 33.
Given CCC => DMK , it's a base11 system using digits C through M . It's unclear from your description whether you want:
CCC, CCD, CCE ... CCK
CDC, CDD, CDE ... CDK
...
Or if you want
CCC, CCD, CCE ... CCM
CDC, CDD, CDE ... CDM
...
If you want the former, then each digit position is a different base, and things get even more complicated.
How you define things changes how you would write the code to generate the values.
Regardless or how you want to interpret your alpha values, it's clear that your base26 conversion functions are incorrect.
Your conversion from int to string has a few errors. In particular, subtracting 1 from the value is going to give you trouble. You can see that if you were to pass 0 to the function. The result would be an empty string.
Here's a correct function:
static string ConvertToBase26(int value)
{
const int a = (int)'A';
var result = new StringBuilder();
do
{
var remainder = value % 26;
value /= 26;
result.Insert(0, (char)(a + remainder);
} while (value > 0);
return result.ToString();
}
Your conversion from base26 to integer has similar errors, due to subtracting 1 from things. Remember, A acts like 0 . The corrected function:
static int ConvertFromBase26(string value)
{
const int a = (int)'A';
int result = 0;
foreach (var c in value.ToUpper())
{
result = (result * 26) + (c  a);
}
return result;
}
I recommend renaming your base conversion functions. Your ConvertAlpha function converts an integer to a base26 string. That's not at all clear in the name, as one could misconstrue "ConvertAlpha" to mean "ConvertFromAlpha". I would recommend ConvertToBase26 and ConvertFromBase26 , which are much more explicit and unambiguous.
