- private string[] array = new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "S", "Y", "Z" };
- public void change(int number,ref string result)
- {
- int remainder = number % 36;
- result = array[remainder] + result;
- int a = number / 36;
- if (a >= 36)
- {
- change(a,ref result);
- }
- else if(a>0)
- {
- result = array[a] + result;
- }
- }
- 调用:
- string result = "";
- int number = 15648; //十进制数
- change(number,ref result);
- console.write(result );
- //该片段来自于http://www.codesnippet.cn/detail/1611201514008.html
来源: http://www.codesnippet.cn/detail/1611201514008.html