Class CharSpanExtensions
Extension methods for
Inheritance
Namespace: X10D.Text
Assembly: X10D.dll
Syntax
public static class CharSpanExtensions : object
Methods
| Improve this Doc View SourceCountSubstring(ReadOnlySpan<Char>, ReadOnlySpan<Char>)
Counts the occurrences of a substring within the current character span.
Declaration
public static int CountSubstring(this ReadOnlySpan<char> haystack, ReadOnlySpan<char> needle)
Parameters
Type | Name | Description |
---|---|---|
ReadOnlySpan<System.Char> | haystack | The haystack search space. |
ReadOnlySpan<System.Char> | needle | The character span to count. |
Returns
Type | Description |
---|---|
System.Int32 | An integer representing the count of |
CountSubstring(ReadOnlySpan<Char>, ReadOnlySpan<Char>, StringComparison)
Counts the occurrences of a substring within the current character span, using a specified string comparison method.
Declaration
public static int CountSubstring(this ReadOnlySpan<char> haystack, ReadOnlySpan<char> needle, StringComparison comparison)
Parameters
Type | Name | Description |
---|---|---|
ReadOnlySpan<System.Char> | haystack | The haystack search space. |
ReadOnlySpan<System.Char> | needle | The character span to count. |
StringComparison | comparison | The string comparison method used for determining substring count. |
Returns
Type | Description |
---|---|
System.Int32 | An integer representing the count of |
CountSubstring(Span<Char>, ReadOnlySpan<Char>)
Counts the occurrences of a substring within the current character span.
Declaration
public static int CountSubstring(this Span<char> haystack, ReadOnlySpan<char> needle)
Parameters
Type | Name | Description |
---|---|---|
Span<System.Char> | haystack | The haystack search space. |
ReadOnlySpan<System.Char> | needle | The character span to count. |
Returns
Type | Description |
---|---|
System.Int32 | An integer representing the count of |
CountSubstring(Span<Char>, ReadOnlySpan<Char>, StringComparison)
Counts the occurrences of a substring within the current character span, using a specified string comparison method.
Declaration
public static int CountSubstring(this Span<char> haystack, ReadOnlySpan<char> needle, StringComparison comparison)
Parameters
Type | Name | Description |
---|---|---|
Span<System.Char> | haystack | The haystack search space. |
ReadOnlySpan<System.Char> | needle | The character span to count. |
StringComparison | comparison | The string comparison method used for determining substring count. |
Returns
Type | Description |
---|---|
System.Int32 | An integer representing the count of |
Repeat(ReadOnlySpan<Char>, Int32)
Repeats a span of characters a specified number of times.
Declaration
public static string Repeat(this ReadOnlySpan<char> value, int count)
Parameters
Type | Name | Description |
---|---|---|
ReadOnlySpan<System.Char> | value | The string to repeat. |
System.Int32 | count | The repeat count. |
Returns
Type | Description |
---|---|
System.String | A string containing |
Repeat(ReadOnlySpan<Char>, Int32, Span<Char>)
Repeats a span of character a specified number of times, writing the result to another span of characters.
Declaration
public static void Repeat(this ReadOnlySpan<char> value, int count, Span<char> destination)
Parameters
Type | Name | Description |
---|---|---|
ReadOnlySpan<System.Char> | value | The span of characters to repeat. |
System.Int32 | count | The repeat count. |
Span<System.Char> | destination | The destination span to write to. |