diff options
Diffstat (limited to 'src/System.Private.CoreLib/shared')
-rw-r--r-- | src/System.Private.CoreLib/shared/System/String.Searching.cs | 2 | ||||
-rw-r--r-- | src/System.Private.CoreLib/shared/System/StringSpanHelpers.cs | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/System.Private.CoreLib/shared/System/String.Searching.cs b/src/System.Private.CoreLib/shared/System/String.Searching.cs index d761ea271..5aa002b72 100644 --- a/src/System.Private.CoreLib/shared/System/String.Searching.cs +++ b/src/System.Private.CoreLib/shared/System/String.Searching.cs @@ -252,7 +252,7 @@ namespace System // in each byte in the character is used to index into this map to get the // right block, the value of the remaining 5 msb are used as the bit position // inside this block. - private static unsafe void InitializeProbabilisticMap(uint* charMap, char[] anyOf) + private static unsafe void InitializeProbabilisticMap(uint* charMap, ReadOnlySpan<char> anyOf) { bool hasAscii = false; uint* charMapLocal = charMap; // https://github.com/dotnet/coreclr/issues/14264 diff --git a/src/System.Private.CoreLib/shared/System/StringSpanHelpers.cs b/src/System.Private.CoreLib/shared/System/StringSpanHelpers.cs index a84903518..1c127b19d 100644 --- a/src/System.Private.CoreLib/shared/System/StringSpanHelpers.cs +++ b/src/System.Private.CoreLib/shared/System/StringSpanHelpers.cs @@ -90,6 +90,19 @@ namespace System return -1; } + public static bool Contains(this ReadOnlySpan<char> source, char value) + { + for (int i = 0; i < source.Length; i++) + { + if (source[i] == value) + { + return true; + } + } + + return false; + } + public static ReadOnlySpan<char> Remove(this ReadOnlySpan<char> source, int startIndex, int count) { if (startIndex < 0) throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_StartIndex); |