文本"123:234;321:123;789:987;"现在知道 "321:*;"   要获取 左边 *号里的数据。应该是 “123”;

解决方案 »

  1.   

    文本"123:234;321:123;789:987;"  保存到一个  string   yy里 
    在用 string [ ] xx = yy.Split ( ' ; ' ) ;
    在foreach ( string item in xx)
    {
              if ( item.Split ( ' : ' ) [ 0 ]  .Equals( " 321 " )
               {
                      string zz= item.Split ( ' : ' ) [ 1 ] 
               }
    }
    我就这样  解·······对不对你的胃口就不知道了
      

  2.   


                string s = "123:234;321:123;789:987;";            Match m = Regex.Match(s, @"321:(\d+)");            Console.WriteLine(m.Groups[1]);
      

  3.   

    string result = Regex.Match(yourStr,@"(?<=321:)\d+").Value;