数字转成字母的方法
一个将数字转成字母的方法
1 private static string Num_to_letter(int value) 2 { 3 //此处判断输入的是否是正整数数字 4 if (Regex.IsMatch(value.ToString(), "^\\d+$")) 5 { 6 int remainder = value % 26; 7 //remainder = (remainder == 0) ? 26 : remainder; 8 int front = (value - remainder) / 26; 9 if (front == 0) 10 { 11 return Level[remainder]; 12 } 13 else if (front < 26) 14 { 15 return Level[front - 1] + Level[remainder]; 16 } 17 else 18 { 19 return Num_to_letter(front) + Level[remainder]; 20 } 21 } 22 else 23 { 24 return string.Empty; 25 } 26 27 }