1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-09 23:45:42 +00:00

fix: accept ReadOnlySpan not Span for search needle

This commit is contained in:
Oliver Booth 2023-03-30 21:23:46 +01:00
parent 4c62367303
commit 02947944cd
No known key found for this signature in database
GPG Key ID: 20BEB9DC87961025

View File

@ -11,7 +11,7 @@ public static class CharSpanExtensions
/// <param name="haystack">The haystack search space.</param>
/// <param name="needle">The character span to count.</param>
/// <returns>An integer representing the count of <paramref name="needle" /> inside <paramref name="haystack" />.</returns>
public static int CountSubstring(this Span<char> haystack, Span<char> needle)
public static int CountSubstring(this Span<char> haystack, ReadOnlySpan<char> needle)
{
return CountSubstring(haystack, needle, StringComparison.Ordinal);
}
@ -23,7 +23,7 @@ public static class CharSpanExtensions
/// <param name="needle">The character span to count.</param>
/// <param name="comparison">The string comparison method used for determining substring count.</param>
/// <returns>An integer representing the count of <paramref name="needle" /> inside <paramref name="haystack" />.</returns>
public static int CountSubstring(this Span<char> haystack, Span<char> needle, StringComparison comparison)
public static int CountSubstring(this Span<char> haystack, ReadOnlySpan<char> needle, StringComparison comparison)
{
return CountSubstring((ReadOnlySpan<char>)haystack, needle, comparison);
}