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