void replacingMethod() {
       Regex r = new Regex("<.*>");
		
       MyReplacer r = new MyReplacer();
       // Assign the replace method to the MatchEvaluator delegate.
       MatchEvaluator myEvaluator = new MatchEvaluator(r.Replace);
       // Replace matched characters using the delegate method.
       sInput = r.Replace(sInput, myEvaluator);
    }
Exemplo n.º 2
0
 /// <summary>
 /// 按照条件替换字符串
 /// </summary>
 /// <param name="source">源字符串</param>
 /// <param name="conditions">替换条件集合</param>
 /// <returns></returns>
 public static string ReplaceString(string source, IEnumerable <ReplaceItem> conditions)
 {
     return(MyReplacer.Replace(source, conditions));
 }