double和string之間
string strA;
double dB;
//字符串轉換為浮點數
strA = "43.23";
dB = System.Convert.ToDouble(strA);
//浮點數轉換為字符串
dB = 234.345;
strA = dB.ToString();
int和string之間
int a = 15;
string s1 = a.ToString();
string s2 = Convert.ToString(a);
string s = "18";
int a1 = int.Parse(s);
int a2;
int.TryParse(s, out a2);
int a3 = Convert.ToInt32(s);
取string字符串后幾位數
string nc = "12345"
string b = nc.Remove(0, nc.Length - 2);
---b=“45”
取string字符串中某一段數據
string bb = nc.Substring(0, 4);
---bb =“1234”