-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add strings.count(string, substring)
built-in function
#6827
Comments
Hello, may I take this up? |
Thank you! @Manish-Giri |
Just checking in, @Manish-Giri. Any progress to report? Let us know if you need any help! |
Hello @anderseknert, thank you for offering help! I might actually need some here. The only reference of Lines 1072 to 1083 in e0ee741
which leads to Lines 231 to 261 in 5464b00
I couldn't locate any actual usages of Would you be able to help point me towards where I need to look? |
I don't think there are any usages of that in OPA's codebase. Built-in functions are commonly tested using the "YAML test suite", which you'll find here. Once you've built an implementation of You can also search the list of closed PRs to find other built-in functions that have been added, and what is in those PRs. Here's a recent example. Note that you don't need to write the I hope that helps! And feel free to ask more questions. |
Fixes open-policy-agent#6827 Signed-off-by: Manish-Giri <[email protected]>
Fixes open-policy-agent#6827 Signed-off-by: Manish Giri <[email protected]>
@anderseknert Thank you very much for explaining the approach and sharing these resources, I found them very helpful! A first stab at a solution is now available in the linked pull request, ready for review. There does appear to be a problem with the DCO check, although I did amend the commit message after, to match the expected format. |
Fixes open-policy-agent#6827 Signed-off-by: Manish Giri <[email protected]>
Fixes open-policy-agent#6827 Signed-off-by: Manish Giri <[email protected]>
Fixes open-policy-agent#6827 Signed-off-by: Manish Giri <[email protected]>
Fixes open-policy-agent#6827 Signed-off-by: Manish Giri <[email protected]>
Fixes open-policy-agent#6827 Signed-off-by: Manish Giri <[email protected]>
Fixes open-policy-agent#6827 Signed-off-by: Manish Giri <[email protected]>
For cases where you need to count the occurances of a substring in some text, it would be nice if instead of this:
One could do this:
"Nice" in that it more clearly communicates intent, would be easier to find in documentation, and likely can be made more performant.
The text was updated successfully, but these errors were encountered: