-
Notifications
You must be signed in to change notification settings - Fork 95
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
refactor: Function capitalize word #460
refactor: Function capitalize word #460
Conversation
fix: in CapitalizeWord add strings.Join(capWords, " ") to return.
pls resolve conflict |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #460 +/- ##
==========================================
- Coverage 57.71% 57.20% -0.51%
==========================================
Files 180 184 +4
Lines 14614 15005 +391
==========================================
+ Hits 8434 8584 +150
- Misses 5552 5791 +239
- Partials 628 630 +2
Continue to review full report at Codecov.
|
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.
LGTM
* feat: implement function capitalize_word * test: add test TestCapitalizeWordAction fix: in CapitalizeWord add strings.Join(capWords, " ") to return. * fix: in CapitalizeWord use Fields instead of Split to takecare of dup spaces. * fix: redo function to keep spaces and handle unicode, add tests. * fix: update comment for NewCapitalizeWordAction * refactor: better readability, cleaner code in CapitalizeWord. Add test case.
What problem does this PR solve?
Issue Number: close #488
Problem Summary
Team, thank you for the quick PR review.

By email I got xdlbdy's comment with implementation idea, (not sure how to find it on GitHub) so here is the screenshot:
Questions:
!unicode.IsSpace
as a criteria that we are inWord? If we useunicode.IsLetter(r) || unicode.IsNumber(r)
the logic will treat other symbols as notinWord
. For example a stringlet 'em go
, will be capitalized toLet 'Em Go
. I guess the question is, how do we want to capitalize cases like'em
and other cases where the word starts with a symbol that is neither a number nor a letter.What is changed and how does it work?
[]rune
from the get go.'em
'em
.Check List
Tests