string MyHex;
MyHex = (5).ToString("X"); // Returns 5.
MyHex = (10).ToString("X"); // Returns A.
MyHex = (459).ToString("X"); // Returns 1CB.
MyHex = (5).ToString("X"); // Returns 5.
MyHex = (10).ToString("X"); // Returns A.
MyHex = (459).ToString("X"); // Returns 1CB.
不忙的话再问个问题,我在一下sub中做了好多转换,能不能给他们写成function 返回值就行了。我试了好像不行。
如:
string strMobile = this.txtMobile.Text+"F";
string txt2="";
for (int i = 1; i < strMobile.Length; i=i+2)
{
txt2 = txt2 + strMobile.Substring(i,1); txt2 = txt2 + strMobile.Substring(i-1,1);
}
写成strTOstr函数以后,
我用strTOstr(this.textBox1.text) 就返回一个值,不用在过程中定义那么多的东西。
string strMobile = this.txtMobile.Text+"F";
string txt2="";
for (int i = 1; i < strMobile.Length; i=i+2)
{
txt2 = txt2 + strMobile.Substring(i,1); txt2 = txt2 + strMobile.Substring(i-1,1);
}
return txt2;
}