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; } }
public TextFindForm(GetContentMethod method, FindCallback findCall, ReplaceCallback replaceCall) : this(method, findCall, true) { this.replaceCall = replaceCall; }