替换VB.net中的所有功能。

| 如何替换字符串可变的所有字符串
dim str = \"I am testing and testing and testing\"
替换为“和”之后
ReplaceAll(str,\"and\",\"or\")
如何用区分大小写而不是区分大小写替换所有内容?
已邀请:
听起来像是正则表达式的情况: 从http://weblogs.asp.net/jgalloway/archive/2004/02/11/71188.aspx
using System.Text.RegularExpressions;

string myString = \"find Me and replace ME\";
string strReplace = \"me\";

myString = Regex.Replace(myString, \"me\", strReplace, RegexOptions.IgnoreCase);
    Dim str As String = \"I am testing and testing and testing\"
    str = str.Replace(\"and\", \"or\")
正如Matt和RQDQ所建议的那样,尽管使用了正则表达式,但仍可以使用VB糖,例如:
Replace(expression, find, replacement, start, count, compare)
从文档中。

要回复问题请先登录注册