如何截取数据库里一个字段里英文和中文名字
请问
比如数据库里有个名字:Fax张楚晋
我想在界面里用两个Label把他们读出来分解开
结果就是:一个label读的是Fax
另一个label读的是张楚晋
那么在代码里如何实现
谢谢各位朋友帮忙
[解决办法]
- C# code
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(); } }}