-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[API Proposal]: ReadOnlySpan<char>.StartsWithAny(SearchValues<string>) and ReadOnlySpan<char>.EndsWithAny(SearchValues<string>) #110115
Comments
Tagging subscribers to this area: @dotnet/area-system-memory |
What sort of use cases do you have for |
Good question; I actually wasn't aware of that. I assume |
Re I don't currently have a use case for |
As a workaround, you can use |
Assigned to @krwq for triage and consultation with @MihaZupan and @stephentoub. |
Background and motivation
There currently doesn't seem to be a means of checking whether the beginning or the end of a string equals to any of the values contained in a specified set of values in an optimized way using
SearchValues<string>
that was introduced in .NET 9. There are other specialized extension APIs involvingReadOnlySpan<char>
andSearchValues<string>
that were recently added (e.g.IndexOfAny<T>(ReadOnlySpan<char>, SearchValues<string>)
,ContainsAny(ReadOnlySpan<char>, SearchValues<string>)
et al.) but this particular API seems to be missing.One use case could be if you need to efficiently check whether a string starts with any one of a particular set of prefixes in order to determine whether your application code supports or handles that particular item.
See also #94155.
API Proposal
API Usage
Alternative Designs
N/A
Risks
N/A
The text was updated successfully, but these errors were encountered: