diff options
author | smasher164 <aindurti@gmail.com> | 2021-10-28 17:08:22 -0400 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2021-11-05 21:27:34 +0000 |
commit | 7aed6dd7e18e2ad3ac0f4eb692188ed7a90b778b (patch) | |
tree | 7ce3a74147208bfe124bb48a05ac00ebcb3ba964 /src/strings | |
parent | 58ec92527041f88d427390a92619cd9a927b6aba (diff) | |
download | go-7aed6dd7e18e2ad3ac0f4eb692188ed7a90b778b.tar.gz go-7aed6dd7e18e2ad3ac0f4eb692188ed7a90b778b.zip |
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>
Diffstat (limited to 'src/strings')
-rw-r--r-- | src/strings/strings.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/strings/strings.go b/src/strings/strings.go index bc734048c3..c5a29e95f6 100644 --- a/src/strings/strings.go +++ b/src/strings/strings.go @@ -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 |