c#字符串轉(zhuǎn)數(shù)字的函數(shù)|c#字符串轉(zhuǎn)數(shù)字的無錯函數(shù)|c#字符串轉(zhuǎn)數(shù)字的最好函數(shù)
//字符串轉(zhuǎn)整數(shù)
public int GetInt(string str) {
int tempInt = 0;
int.TryParse(str,out tempInt);
return tempInt;
}
/字符串轉(zhuǎn)整數(shù)浮點(diǎn)
public decimal GetDecimal(string str)
{
decimal tempDecimal = 0;
decimal.TryParse(str, out tempDecimal);
return tempDecimal;
}
/字符串轉(zhuǎn)小樹整數(shù)
public double GetDouble(string str)
{
double tempDouble = 0;
double.TryParse(str, out tempDouble);
return tempDouble;
}
posted on 2009-02-26 10:17
sanmao 閱讀(451)
評論(0) 編輯 收藏