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

text string
The text to process.
charsToReplace ReadOnlySpan<char>
The characters to replace.
replacement char
The character to replace the old characters with.
skipConsecutiveReplacements bool 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 text is null.