private ReplaceLastOccurrence ( [ s, [ what, [ replacement ) : string | ||
s | [ | |
what | [ | |
replacement | [ | |
Résultat | string |
public static string ReplaceLastOccurrence([NotNull] this string s, [NotNull] string what, [NotNull] string replacement) {
var place = s.LastIndexOf(what, StringComparison.Ordinal);
return place == -1 ? s : s.Remove(place, what.Length).Insert(place, replacement);
}