StringManipulation.ReplaceMany Method
- Namespace
- Kampute.DocToolkit.Support
- Assembly
- Kampute.DocToolkit.dll
Definition
Replaces multiple characters in the given text with a single character.
public static string ReplaceMany(
this string text,
ReadOnlySpan<char> charsToReplace,
char replacement,
bool skipConsecutiveReplacements = false)Parameters
textstring- The text to process.
charsToReplaceReadOnlySpan<char>- The characters to replace.
replacementchar- The character to replace the old characters with.
skipConsecutiveReplacementsbool optional- Indicates whether to skip consecutive occurrences of the replacement character.
Returns
- string
- The text with occurrences of the specified characters replaced by a single character.
Exceptions
- ArgumentNullException
- Thrown when
textisnull.
