Class MemoryExtensions
Contains extension methods for memory types.
public static class MemoryExtensions
- Inheritance
-
MemoryExtensions
- Inherited Members
Methods
EnumerateCodePoints(ReadOnlySpan<char>)
Returns an enumeration of CodePoint from the provided span.
public static SpanCodePointEnumerator EnumerateCodePoints(this ReadOnlySpan<char> span)
Parameters
spanReadOnlySpan<char>The read-only span of char elements representing the text to enumerate.
Returns
Remarks
Invalid UTF-16 sequences will be represented in the enumeration by ReplacementChar.
EnumerateCodePoints(Span<char>)
Returns an enumeration of CodePoint from the provided span.
public static SpanCodePointEnumerator EnumerateCodePoints(this Span<char> span)
Parameters
Returns
Remarks
Invalid UTF-16 sequences will be represented in the enumeration by ReplacementChar.
EnumerateGraphemes(ReadOnlySpan<char>)
Returns an enumeration of grapheme clusters from the provided span.
public static SpanGraphemeEnumerator EnumerateGraphemes(this ReadOnlySpan<char> span)
Parameters
spanReadOnlySpan<char>The read-only span of char elements representing the text to enumerate.
Returns
Remarks
Invalid UTF-16 sequences are treated as ReplacementChar while determining grapheme boundaries.
EnumerateGraphemes(ReadOnlySpan<char>, TerminalWidthOptions)
Returns an enumeration of grapheme clusters from the provided span with terminal-width metadata.
public static SpanGraphemeEnumerator EnumerateGraphemes(this ReadOnlySpan<char> span, TerminalWidthOptions terminalWidthOptions)
Parameters
spanReadOnlySpan<char>The read-only span of char elements representing the text to enumerate.
terminalWidthOptionsTerminalWidthOptionsThe terminal width options used to resolve TerminalCellWidth.
Returns
Remarks
Invalid UTF-16 sequences are treated as ReplacementChar while determining grapheme boundaries. Terminal width options affect only the width metadata on each returned cluster; they do not affect grapheme segmentation.
EnumerateGraphemes(Span<char>)
Returns an enumeration of grapheme clusters from the provided span.
public static SpanGraphemeEnumerator EnumerateGraphemes(this Span<char> span)
Parameters
Returns
Remarks
Invalid UTF-16 sequences are treated as ReplacementChar while determining grapheme boundaries.
EnumerateGraphemes(Span<char>, TerminalWidthOptions)
Returns an enumeration of grapheme clusters from the provided span with terminal-width metadata.
public static SpanGraphemeEnumerator EnumerateGraphemes(this Span<char> span, TerminalWidthOptions terminalWidthOptions)
Parameters
spanSpan<char>The span of char elements representing the text to enumerate.
terminalWidthOptionsTerminalWidthOptionsThe terminal width options used to resolve TerminalCellWidth.
Returns
Remarks
Invalid UTF-16 sequences are treated as ReplacementChar while determining grapheme boundaries. Terminal width options affect only the width metadata on each returned cluster; they do not affect grapheme segmentation.
EnumerateWordSegments(ReadOnlySpan<char>)
Returns an enumeration of Unicode word-boundary segments from the provided span.
public static SpanWordEnumerator EnumerateWordSegments(this ReadOnlySpan<char> span)
Parameters
spanReadOnlySpan<char>The read-only span of char elements representing the text to enumerate.
Returns
Remarks
Invalid UTF-16 sequences are treated as ReplacementChar while determining word boundaries.
EnumerateWordSegments(Span<char>)
Returns an enumeration of Unicode word-boundary segments from the provided span.
public static SpanWordEnumerator EnumerateWordSegments(this Span<char> span)
Parameters
Returns
Remarks
Invalid UTF-16 sequences are treated as ReplacementChar while determining word boundaries.
GetCodePointCount(ReadOnlySpan<char>)
Returns the number of code points in the provided span.
public static int GetCodePointCount(this ReadOnlySpan<char> span)
Parameters
spanReadOnlySpan<char>The read-only span of char elements representing the text to enumerate.
Returns
- int
The number of code points.
GetCodePointCount(Span<char>)
Returns the number of code points in the provided span.
public static int GetCodePointCount(this Span<char> span)
Parameters
Returns
- int
The number of code points.
GetCodePointCount(string)
Returns the number of code points in the provided text.
public static int GetCodePointCount(this string text)
Parameters
textstringThe text to enumerate.
Returns
- int
The number of code points.
GetGraphemeCount(ReadOnlySpan<char>)
Returns the number of grapheme clusters in the provided span.
public static int GetGraphemeCount(this ReadOnlySpan<char> span)
Parameters
spanReadOnlySpan<char>The read-only span of char elements representing the text to enumerate.
Returns
- int
The number of grapheme clusters.
GetGraphemeCount(Span<char>)
Returns the number of grapheme clusters in the provided span.
public static int GetGraphemeCount(this Span<char> span)
Parameters
Returns
- int
The number of grapheme clusters.
GetGraphemeCount(string)
Returns the number of grapheme clusters in the provided text.
public static int GetGraphemeCount(this string text)
Parameters
textstringThe text to enumerate.
Returns
- int
The number of grapheme clusters.
GetTerminalCellWidth(ReadOnlySpan<char>)
Returns the terminal cell width of the provided span.
public static int GetTerminalCellWidth(this ReadOnlySpan<char> span)
Parameters
spanReadOnlySpan<char>The read-only span of char elements representing the text to measure.
Returns
- int
The terminal cell width, or
-1when the configured control-character policy treats any grapheme cluster in the text as non-printable.
GetTerminalCellWidth(ReadOnlySpan<char>, TerminalWidthOptions)
Returns the terminal cell width of the provided span.
public static int GetTerminalCellWidth(this ReadOnlySpan<char> span, TerminalWidthOptions terminalWidthOptions)
Parameters
spanReadOnlySpan<char>The read-only span of char elements representing the text to measure.
terminalWidthOptionsTerminalWidthOptionsThe terminal width options to apply while measuring.
Returns
- int
The terminal cell width, or
-1when the configured control-character policy treats any grapheme cluster in the text as non-printable.
GetTerminalCellWidth(Span<char>)
Returns the terminal cell width of the provided span.
public static int GetTerminalCellWidth(this Span<char> span)
Parameters
Returns
- int
The terminal cell width, or
-1when the configured control-character policy treats any grapheme cluster in the text as non-printable.
GetTerminalCellWidth(Span<char>, TerminalWidthOptions)
Returns the terminal cell width of the provided span.
public static int GetTerminalCellWidth(this Span<char> span, TerminalWidthOptions terminalWidthOptions)
Parameters
spanSpan<char>The span of char elements representing the text to measure.
terminalWidthOptionsTerminalWidthOptionsThe terminal width options to apply while measuring.
Returns
- int
The terminal cell width, or
-1when the configured control-character policy treats any grapheme cluster in the text as non-printable.
GetTerminalCellWidth(string)
Returns the terminal cell width of the provided text.
public static int GetTerminalCellWidth(this string text)
Parameters
textstringThe text to measure.
Returns
- int
The terminal cell width, or
-1when the configured control-character policy treats any grapheme cluster in the text as non-printable.
GetTerminalCellWidth(string, TerminalWidthOptions)
Returns the terminal cell width of the provided text.
public static int GetTerminalCellWidth(this string text, TerminalWidthOptions terminalWidthOptions)
Parameters
textstringThe text to measure.
terminalWidthOptionsTerminalWidthOptionsThe terminal width options to apply while measuring.
Returns
- int
The terminal cell width, or
-1when the configured control-character policy treats any grapheme cluster in the text as non-printable.