26进制转换,用26字母表示

public void Run()
{
string str = GetText(12356);
Console.WriteLine(str);

}

public string GetText(int n)
{
string s = string.Empty;
while (n > 0)
{
int m = n % 26;
if (m == 0) m = 26;
s = (char)(m + 64) + s;
n = (n - m) / 26;
}
return s;
}

posted @ 2020-12-29 15:29  OnlyUsername  阅读(268)  评论(0)    收藏  举报