请问
 比如数据库里有个名字:Fax张楚晋 我想在界面里用两个Label把他们读出来分解开
 结果就是:一个label读的是Fax
         另一个label读的是张楚晋
 那么在代码里如何实现谢谢各位朋友帮忙

解决方案 »

  1.   

    例如:
    string s = Regex.Replace("Fax1111", "[a-zA-Z]", "");
    Console.WriteLine(s);改改第二个参数就可以了
      

  2.   

    string   s   =   Regex.Replace("Fax1111",   "[a-zA-Z]",   ""); 
    Console.WriteLine(s);
    this.lable1.text=s;
      

  3.   


    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;namespace RegexEx
    {
        class Program
        {
            static void Main(string[] args)
            {
                string str = "Fax张楚晋";
                string temp = System.Text.RegularExpressions.Regex.Replace(str, "[a-zA-Z]", "").ToString();
                Console.Write("替换字母后的字符:{0}\n",temp);
                System.Text.RegularExpressions.Match m = System.Text.RegularExpressions.Regex.Match(str, @"(?<text>(^[a-zA-Z]+))", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                if (m.Success)
                {
                    string s = m.Groups["text"].Value.ToString();
                    Console.Write(s);
                }
                Console.Read();
            }
        }
    }