StringManipulation.TranslateChars Method

Namespace
Kampute.DocToolkit.Support
Assembly
  • Kampute.DocToolkit.dll

Definition

Translates multiple characters in the given string to corresponding characters.
public static string TranslateChars(this string text, ReadOnlySpan<char> fromChars, ReadOnlySpan<char> toChars)

Parameters

text string
The string to process.
fromChars ReadOnlySpan<char>
The characters to translate from.
toChars ReadOnlySpan<char>
The characters to translate to.

Returns

string
A new string with the specified characters translated.

Exceptions

ArgumentNullException
Thrown when text is null.
ArgumentException
Thrown when the lengths of fromChars and toChars are not the same.