Replacer - IvanStoychev/IvanStoychev.Useful.String.Extensions GitHub Wiki

This is a list of all methods in the "Replacer" class. The class isn't actually accessible from the NuGet package but it is used to logically separate methods for better organization.


Replace (string newString, params string[] oldStrings)

Introduced in version 1.0.0


Iterates through the oldStrings array and replaces any occurrence of its members with newString. Case sensetive.
oldStrings is specified with the params keyword to make it easy to call this method with a variable number of strings, like so Replace("nine", "one", "two", "three", "four", "and", "etc").

Remark: The order of the strings passed as the oldStrings parameter matters, as the method foreaches over them. Thus, if given the original string "test dominus" and a newString of "word" a parameter of "st", "test" will produce the result "teword dominus", while a parameter of "test", "st" will produce "word dominus".


Replace (bool ignoreCase, string newString, params string[] oldStrings)

Introduced in version 1.0.0


Iterates through the oldStrings array and replaces any occurrence of its members with newString, ignoring case if ignoreCase is true.
oldStrings is specified with the params keyword to make it easy to call this method with a variable number of strings, like so Replace("nine", "one", "two", "three", "four", "and", "etc").

Remark: The order of the strings passed as the oldStrings parameter matters, as the method foreaches over them. Thus, if given the original string "test dominus" and a newString of "word" a parameter of "st", "test" will produce the result "teword dominus", while a parameter of "test", "st" will produce "word dominus".


Replace (IEnumerable<string> oldStrings, string newString)

Introduced in version 1.0.0


Iterates through the oldStrings collection and replaces any occurrence of its members with newString. Case sensetive.

Remark: The order of the strings in the enumerable matters, as the method foreaches over them. Thus, if given the original string "test dominus" and a newString of "word" an enumerable of "st", "test" will produce the result "teword dominus", while an enumerable of "test", "st" will produce "word dominus".


Replace (IEnumerable<string> oldStrings, string newString, bool ignoreCase)

Introduced in version 1.0.0


Iterates through the oldStrings collection and replaces any occurrence of its members with newString, considering case if ignoreCase is false.

Remark: The order of the strings in the enumerable matters, as the method foreaches over them. Thus, if given the original string "test dominus" and a newString of "word" an enumerable of "st", "test" will produce the result "teword dominus", while an enumerable of "test", "st" will produce "word dominus".

⚠️ **GitHub.com Fallback** ⚠️