private ForceReplace ( [ s, [ oldValue, [ newValue ) : string | ||
s | [ | |
oldValue | [ | |
newValue | [ | |
return | string |
public static string ForceReplace([NotNull] this string s, [NotNull] string oldValue, [NotNull] string newValue) {
var index = s.IndexOf(oldValue, StringComparison.CurrentCulture);
if (index == -1) throw new Exception("Old value not found");
return s.Substring(0, index) + newValue + s.Substring(index + oldValue.Length);
}
StringExtension::ForceReplace ( [ s, [ oldValue, [ newValue, System.StringComparison comparison ) : string |