如何截取数据库里一个字段里英文和中文名字 请问 比如数据库里有个名字:Fax张楚晋 我想在界面里用两个Label把他们读出来分解开 结果就是:一个label读的是Fax 另一个label读的是张楚晋 那么在代码里如何实现谢谢各位朋友帮忙 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 例如:string s = Regex.Replace("Fax1111", "[a-zA-Z]", "");Console.WriteLine(s);改改第二个参数就可以了 string s = Regex.Replace("Fax1111", "[a-zA-Z]", ""); Console.WriteLine(s);this.lable1.text=s; 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(); } }} straGrid没绑定数据库, 用AddNewRow()无法新建行,急救! AxWebBrowser控件怎样才能实现.net2.0下的WebBrowser控件WebForm调用WinForm的功能? 存储过程输出参数的例子 来人看看吧,一个边角问题 高分求!vs2005用datagridview控件调用mdb数据库并查询的源码例子 怎样在Access 2003中生成流水号? 我用C#怎么把中文信息写到数据库里都成问号了 最简单但有技巧的正则表达式:分隔符分隔的字符串 简单问题!连接字符串怎么写?! 哪里可以下载到C# primer 关于richtextbox字符数 有人做过复合组件吗?
string s = Regex.Replace("Fax1111", "[a-zA-Z]", "");
Console.WriteLine(s);改改第二个参数就可以了
Console.WriteLine(s);
this.lable1.text=s;
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();
}
}
}