c#字符串轉(zhuǎn)數(shù)字的函數(shù)|c#字符串轉(zhuǎn)數(shù)字的無(wú)錯(cuò)函數(shù)|c#字符串轉(zhuǎn)數(shù)字的最好函數(shù)
//字符串轉(zhuǎn)整數(shù)
public int GetInt(string str) {
int.TryParse(str,out tempInt);
return tempInt;
}
/字符串轉(zhuǎn)整數(shù)浮點(diǎn)
{
decimal tempDecimal = 0;
decimal.TryParse(str, out tempDecimal);
return tempDecimal;
}
/字符串轉(zhuǎn)小樹(shù)整數(shù)
{
double tempDouble = 0;
double.TryParse(str, out tempDouble);
return tempDouble;
}