Class StringUtility
public static class StringUtility
- Inheritance
-
StringUtility
- Inherited Members
Methods
LevenshteinDistance(char*, int, char*, int, CultureInfo, LevenshteinOptions)
Computes the number of edits required to turn one string to another.
public static int LevenshteinDistance(char* a, int aChars, char* b, int bChars, CultureInfo formatProvider, LevenshteinOptions options = (LevenshteinOptions)0)
Parameters
achar*aCharsintbchar*bCharsintformatProviderCultureInfooptionsLevenshteinOptions
Returns
Remarks
LevenshteinDistance(ReadOnlySpan<char>, ReadOnlySpan<char>, CultureInfo, LevenshteinOptions)
Computes the number of edits required to turn one string to another.
public static int LevenshteinDistance(ReadOnlySpan<char> a, ReadOnlySpan<char> b, CultureInfo formatProvider, LevenshteinOptions options = (LevenshteinOptions)0)
Parameters
aReadOnlySpan<char>bReadOnlySpan<char>formatProviderCultureInfooptionsLevenshteinOptions
Returns
Remarks
LevenshteinDistance(string, string, CultureInfo, LevenshteinOptions)
Computes the number of edits required to turn one string to another.
public static int LevenshteinDistance(string a, string b, CultureInfo formatProvider, LevenshteinOptions options = (LevenshteinOptions)0)
Parameters
astringbstringformatProviderCultureInfooptionsLevenshteinOptions
Returns
Remarks
Exceptions
RemoveMany(ReadOnlySpan<char>, bool, params ReadOnlySpan<char>)
Remove any occurances of any character in replaceables from source and return it as a string.
public static string RemoveMany(ReadOnlySpan<char> source, bool caseSensitive, params ReadOnlySpan<char> replaceables)
Parameters
sourceReadOnlySpan<char>caseSensitiveboolreplaceablesReadOnlySpan<char>
Returns
RemoveMany(string?, bool, params ReadOnlySpan<char>)
Remove any occurances of any character in replaceables from source and return it as a string.
public static string? RemoveMany(string? source, bool caseSensitive, params ReadOnlySpan<char> replaceables)
Parameters
sourcestringcaseSensitiveboolreplaceablesReadOnlySpan<char>
Returns
Remarks
Truncate(string?, int)
Truncates a string if it's over a certain length.
public static string? Truncate(this string? str, int length)
Parameters
Returns
TruncateUtf8Bytes(ReadOnlySpan<char>, int, out int)
Truncates text so that it's UTF-8 byte count is less than or equal to maximumBytes.
public static ReadOnlySpan<char> TruncateUtf8Bytes(ReadOnlySpan<char> text, int maximumBytes, out int byteLength)
Parameters
textReadOnlySpan<char>maximumBytesintbyteLengthintThe length in UTF-8 bytes of the truncated text.
Returns
TruncateWithEllipses(string?, int)
Truncates a string if it's over a certain length.
public static string? TruncateWithEllipses(this string? str, int length)