Replace的使用? 例如一个字符串abcda我只想替代第一个a而如果我用Replcae函数,将会将两个啊都替代,我该怎么做呢? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 stringbuilder pattern = new stringbuilder("abcda");pattern.replace("a",null,0,1);参考 正则也是类似 获取第一个匹配然后用regex.replace()string xx = "abcda"; string str=xx.Replace(xx[xx.IndexOf("a")].ToString(),"b"); string test="abcda"; Regex r=new Regex("[a]"); if(r.IsMatch(test)) { test= r.Replace(A,"b",1,0); } List<char> wo = new List<char>(); string a = "abcda"; for (int i = 0; i < a.Length; i++) { wo.Add(a[i]); } a = a.Replace(wo[0],'b'); test= r.Replace(test,"b",1,0); 麻烦大家帮到顶一下http://www.abab123.com/bbs/down.asp?html=1471315http://www.abab123.com/bbs/down.asp?html=1471315 stringbuilder pattern = new stringbuilder("abcda");pattern.replace("a","要替换的字符",0,1); 关于C#编译的程序 【菜鸟问题】Alert对话框,我怎么让他既有确定又有取消? 怎么吧字符串转化为类似%u591A%u591A%u5173%u7167%u591A%u591A%u5173%u7167类型 B/S 和C/S谁更有市场 C#中查询指定年份记录的SQL语句 用PDA开发过无线点菜系统,问题请教??? “_Default”并不包含“Datalist1”的定义 有关日期查询的小问题,但老是不清楚 关于DataGrid显示自己指定的列标题和列? 菜鸟送分!! 急!sql远程连接问题 如何显示值 各位高手请进
pattern.replace("a",null,0,1);
参考
string str=xx.Replace(xx[xx.IndexOf("a")].ToString(),"b");
Regex r=new Regex("[a]");
if(r.IsMatch(test))
{
test= r.Replace(A,"b",1,0);
}
string a = "abcda";
for (int i = 0; i < a.Length; i++)
{
wo.Add(a[i]);
}
a = a.Replace(wo[0],'b');
http://www.abab123.com/bbs/down.asp?html=1471315http://www.abab123.com/bbs/down.asp?html=1471315
pattern.replace("a","要替换的字符",0,1);