-
Notifications
You must be signed in to change notification settings - Fork 2
stringutil: Handle properly acronyms in the CamelToSnakeCase #79
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
Conversation
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 PR is being reviewed by Cursor Bugbot
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| } | ||
|
|
||
| return strings.ToLower(s) | ||
| return strings.ToLower(strings.TrimPrefix(s, "_")) |
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.
Bug: Regex Overlap Causes Double Underscore
The implementation introduces double underscores when an acronym is followed by a capitalized word. When the second regex ([A-Z]+) matches a sequence of uppercase letters that already has an underscore prefix from the first pass, it adds another underscore. For example, "WithAcronymLikeURL" becomes "with_acronym_like__url" instead of the expected "with_acronym_like_url" due to the double underscore before "url". The test case will fail because the actual output doesn't match the expected output.
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.
say what? 🫨
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.
Bot is tired it seems ![]()
| } | ||
|
|
||
| return strings.ToLower(s) | ||
| return strings.ToLower(strings.TrimPrefix(s, "_")) |
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.
Bot is tired it seems ![]()
What does this PR do?
Fixes #
What are the observable changes?
Good PR checklist
Additional Notes