现在的位置: 首页 > 综合 > 正文

2,8,10,16进制转化问题

2013年11月07日 ⁄ 综合 ⁄ 共 303字 ⁄ 字号 评论关闭

net 为我们提供了丰富的转化方法,很简单

        public string ConvertString(string value, int fromBase, int toBase)
        {

            int intValue = Convert.ToInt32(value, fromBase);

            return Convert.ToString(intValue, toBase);
        }

fromBase, 要转化的进制

toBase, 要转化为的进制 

 

For Example:    this.textBox1.Text = ConvertString("D0E7B0", 16, 10);

抱歉!评论已关闭.