-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Subslice search #54961
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
Comments
At least there is a third-party crate based on stdlib implementation for strings: https://github.com/strake/subslice.rs |
I think this is a common function that should live in the standard library of any programming language. |
I'm also surprised by this. It seems that |
Though actually, |
I've also very much desired this functionality, particularly to check if a byte slice exists within a
|
As enhancement, I think stdlib should contain functions that search a subslice inside a given slice:
For the common case of T:Copy items the true stdlib functions should specialize using a smarter algorithm, like:
https://en.wikipedia.org/wiki/Knuth%E2%80%93Morris%E2%80%93Pratt_algorithm
(Similar functions are useful for iterators too).
The text was updated successfully, but these errors were encountered: