-
Notifications
You must be signed in to change notification settings - Fork 163
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
Implemented Str.Count() method #2342
Conversation
SudhanshuJoshi09
commented
Sep 27, 2023
- Implemented Str.Count() method
- Included tests for validating str.count.
1. Added count function for strings str.count().
1. Added a test for str.count() and included it over CMakeList.txt
97c32da
to
fbbd4c4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could have been implemented in IntrinsicFunction.
But this is fine for now, I think.
Looks good, thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good !
Thanks! |
Small nitpicking on this but why to use an algorithm having O(n * m), we do have algos like boyer-moore, or even rabin karp if we do not wish to eat space. some ref for this: https://en.wikipedia.org/wiki/String-searching_algorithm or if you want to check out more of what cpython does, this is a nice place: /* fast search/count implementation, based on a mix between boyer- via: https://github.com/python/cpython/blob/main/Objects/stringlib/fastsearch.h |
@OculusMode awesome, thanks! Can you post your comment as a new issue? Then we can send PRs to implement it. If you are interested in this, that would be great. |
Sure, can do that. |