当前位置: 移动技术网 > IT编程>开发语言>.net > 数字转换成字母帮助类

数字转换成字母帮助类

2018年11月03日  | 移动技术网IT编程  | 我要评论

网游之睡神传说,长汀一中,亲吻姐姐第2季全集

c# 实现excel(导出导入)非常实用的将数字转换成字母

   

/// <summary>
/// 需要转换的行或者列
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
private static string nunbertochar(int index)
{

index = index - 1;
if (index < 0) { throw new exception("invalid parameter"); }

list<string> chars = new list<string>();
do
{
if (chars.count > 0) index--;
chars.insert(0, ((char)(index % 26 + (int)'a')).tostring());
index = (int)((index - index % 26) / 26);
} while (index > 0);

return string.join(string.empty, chars.toarray());

}

 

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网