static private Replace ( MatchEvaluator evaluator, |
||
evaluator | MatchEvaluator | |
regex | ||
input | string | |
count | int | |
startat | int | |
Результат | string |
/// <summary> /// Replaces all occurrences of the previously defined pattern with the recent /// replacement pattern, starting at the character position /// <paramref name="startat"/>. /// </summary> public string Replace(string input, MatchEvaluator evaluator, int count, int startat) { if (input == null) throw new ArgumentNullException(nameof(input)); return RegexReplacement.Replace(evaluator, this, input, count, startat); }
/// <summary> /// Replaces all occurrences of the previously defined pattern with the recent /// replacement pattern, starting at the character position /// <paramref name="startat"/>. /// </summary> public String Replace(String input, MatchEvaluator evaluator, int count, int startat) { if (input == null) { throw new ArgumentNullException("input"); } return(RegexReplacement.Replace(evaluator, this, input, count, startat)); }
/// <summary> /// Replaces all occurrences of the previously defined pattern with the /// <paramref name="replacement"/> pattern, starting at the character position /// <paramref name="startat"/>. /// </summary> public string Replace(string input, string replacement, int count, int startat) { if (input == null) { throw new ArgumentNullException(nameof(input)); } if (replacement == null) { throw new ArgumentNullException(nameof(replacement)); } // Gets the weakly cached replacement helper or creates one if there isn't one already. RegexReplacement repl = RegexReplacement.GetOrCreate(_replref, replacement, caps, capsize, capnames, roptions); return(repl.Replace(this, input, count, startat)); }
/// <summary> /// Replaces all occurrences of the previously defined pattern with the /// <paramref name="replacement"/> pattern, starting at the character position /// <paramref name="startat"/>. /// </summary> public string Replace(string input, string replacement, int count, int startat) { if (input == null) throw new ArgumentNullException(nameof(input)); if (replacement == null) throw new ArgumentNullException(nameof(replacement)); // a little code to grab a cached parsed replacement object RegexReplacement repl = (RegexReplacement)_replref.Get(); if (repl == null || !repl.Pattern.Equals(replacement)) { repl = RegexParser.ParseReplacement(replacement, caps, capsize, capnames, roptions); _replref.Cache(repl); } return repl.Replace(this, input, count, startat); }
public string Replace(string input, string replacement, int count, int startat) { if (input == null) { throw new ArgumentNullException("input"); } if (replacement == null) { throw new ArgumentNullException("replacement"); } RegexReplacement replacement2 = (RegexReplacement)this.replref.Get(); if ((replacement2 == null) || !replacement2.Pattern.Equals(replacement)) { replacement2 = RegexParser.ParseReplacement(replacement, this.caps, this.capsize, this.capnames, this.roptions); this.replref.Cache(replacement2); } return(replacement2.Replace(this, input, count, startat)); }