mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
strings, bytes: deprecate Title
Title doesn't handle Unicode punctuation and language-specific capitalization rules. Replace the BUG comment with a Deprecated one, suggesting a more robust alternative, and allowing Title to be exposed to tooling. Fixes #48367. Change-Id: I952f1f37cd35b587a95893fb022827bdd9ec7de9 Reviewed-on: https://go-review.googlesource.com/c/go/+/359485 Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Cherry Mui <cherryyz@google.com>
This commit is contained in:
parent
58ec925270
commit
7aed6dd7e1
2 changed files with 4 additions and 2 deletions
|
|
@ -706,7 +706,8 @@ func isSeparator(r rune) bool {
|
|||
// Title returns a copy of the string s with all Unicode letters that begin words
|
||||
// mapped to their Unicode title case.
|
||||
//
|
||||
// BUG(rsc): The rule Title uses for word boundaries does not handle Unicode punctuation properly.
|
||||
// Deprecated: The rule Title uses for word boundaries does not handle Unicode
|
||||
// punctuation properly. Use golang.org/x/text/cases instead.
|
||||
func Title(s string) string {
|
||||
// Use a closure here to remember state.
|
||||
// Hackish but effective. Depends on Map scanning in order and calling
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue