Beispiel #1
0
 public static string ReplaceAll(this string s, string oldValue, ReplaceCallback replaceCallback)
 {
     if (string.IsNullOrEmpty(s))
     {
         throw new ArgumentNullException("s");
     }
     try
     {
         var at = s.IndexOf(oldValue, StringComparison.Ordinal);
         while (at != -1)
         {
             s  = s.Replace(oldValue, replaceCallback(s, oldValue, at));
             at = s.IndexOf(oldValue, StringComparison.Ordinal);
         }
         return(s);
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #2
0
 public TextFindForm(GetContentMethod method, FindCallback findCall, ReplaceCallback replaceCall)
     : this(method, findCall, true)
 {
     this.replaceCall = replaceCall;
 }