const string X34 = “123456789abcdefghijklmnpqrstuvwxyz”;
//10进制转为34
string CovvertTo34(int val)
{
string Result = “”;
while(val>=34)
{
Result = X34[val % 34] + Result;
val /= 34;
}
if (val >= 0) Result = X34[val] + Result;
return Result;
}
//34位转为10
int ConvertTo10(string str)
{
int Result = 0;
int Len = str.Length;
for (int i = Len; i > 0;i-- )
{
Result += X34.IndexOf(str[i - 1]) * System.Convert.ToInt32(System.Math.Pow(34, Len - i));
}
return Result;
}
相互转换的时候出去数字0