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
strings: fix Title function #21442
Comments
Can you give an example of an input that would change under your proposal? CC @mpvl |
Sure, the best example is on the Go Cookbook itself:
while
which is grammatically correct (while the result from |
As I suspect changing the existing |
Ah, I understand now. No, I don't think we can or should change Closing. |
I agree that |
First of all: no, this is not #6801!
Instead, I just wanted to point out that the current
strings.Title()
implementation is a 'quick & dirty' way of dealing with titles; it does not respect proper English rules for title naming (although it might be appropriate for some languages, I don't know).A suggestion was made on the Go Cookbook to implement it thusly:
This is a clever and neat trick, and could be used for other languages as well (ex. in Portuguese the
smallwords
would have to include " de do da dos das " but possibly exclude "a" since that is by coincidence also a definite article, etc.).The authors of the Go Cookbook did not seem to add a suggestion here, so I'm doing it 🙂
The text was updated successfully, but these errors were encountered: