C#技术百科
问问你的心你有没有信心 做事情要专一坚定,执着

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  王德田  阅读(1661)  评论(0编辑  收藏  举报