正则\d+  
*****************************************************************************
欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码) http://feiyun0112.cnblogs.com/

解决方案 »

  1.   

    用正则表达式
    Regex reg = new Regex(@"\d+");
    Match m = reg.Match(textBox.Text);
    int cash = int.Parse(m.Value);
    随手写的,有些东西没做判断,自己完善一下。
      

  2.   

    对  用正则   但是如果你文字列格式不变的话 可以用substringint startIndex = this.textBox.Text.IndexOf(":")+1;
    int strLength = this.textBox.Text.IndexOf("元") - startIndex;
    String str = this.textBox.Text.Substring(startIndex, strLength);
      

  3.   

    this.textBox.Text = "现金帐户:1000" 
    string money=this.textBox.Text.subString(this.textBox.Text.indexInfo(':')).TrimEnd("元");
    这样就可以了!
      

  4.   

    textBox.Text = textBox.Text.Substring(0,textBox.Text.Length-1);
      

  5.   

    :***元
    取中间的字符就行,按字符取index,按index再取字符,这个比较好理解,
    更方便的就是用正则表达式了。
      

  6.   

    int i = textBox.Text.IndexOf(":");
    string str =  textBox.Text.Substring(i);
      

  7.   

    要是想用SubString这么写//输入字符串,提出数字部分(可包含小数)
    public static int Money_toint(string str)
    {
       string str_ = "";
       bool flag = true;
       string num = "";
       for(int i=0;i<str.Length;i++)
       {
          str_ = str.SubString(i,1);
          if((str_<30)||(str_>39))
          {
             if((str_ == 0x2E) && (flag == true)
             {
                num += str_;
                flag = fales;
             }
          }
          else
             num += str_;
       }
       return int.Parse(num);//返回金额数字
    }
      

  8.   

    “现金帐户:”用一个Label,多少钱再用textBox“不折腾”