删除字符串中的一些单词 [英] remove some words in a string
本文介绍了删除字符串中的一些单词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
root xmlns ="http://tempuri.org/"欢迎使用.net
这是我的默认字符串....在此我要删除以下内容
xmlns ="http://tempuri.org/"
该怎么做??
在此帮助我
root xmlns="http://tempuri.org/" welcome to .net
this is my default string....In this i want remove the following content
xmlns="http://tempuri.org/"
how to do that???
help me in this
推荐答案
使用正则表达式:
Use a regex:
public static Regex regex = new Regex("xmlns=\\\"(?>[^\"]+)*\\\"",
RegexOptions.IgnoreCase
| RegexOptions.CultureInvariant
| RegexOptions.IgnorePatternWhitespace
| RegexOptions.Compiled
);
string result = regex.Replace(InputText,"");
获取 Expresso [ ^ ]-它是免费的,它检查并生成正则表达式.
Get a copy of Expresso [^] - it''s free, and it examines and generates Regular expressions.
http://msdn.microsoft.com/en-us/library/ms228599.aspx [
这篇关于删除字符串中的一些单词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文