aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/strings
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2019-09-12 23:22:53 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2019-09-12 23:22:53 +0000
commit656297e1fec9a127ff742df16958ee279ccacec5 (patch)
tree24347a35dacea36ce742c32c17420f3e31f17e3d /libgo/go/strings
parentd6ecb707cc5a58816d27908a7aa324c4b0bc67bb (diff)
downloadgcc-656297e1fec9a127ff742df16958ee279ccacec5.zip
gcc-656297e1fec9a127ff742df16958ee279ccacec5.tar.gz
gcc-656297e1fec9a127ff742df16958ee279ccacec5.tar.bz2
libgo: update to Go1.13
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/194698 From-SVN: r275691
Diffstat (limited to 'libgo/go/strings')
-rw-r--r--libgo/go/strings/example_test.go11
-rw-r--r--libgo/go/strings/replace.go3
-rw-r--r--libgo/go/strings/strings.go7
3 files changed, 16 insertions, 5 deletions
diff --git a/libgo/go/strings/example_test.go b/libgo/go/strings/example_test.go
index 4f3a1ce..375f9ca 100644
--- a/libgo/go/strings/example_test.go
+++ b/libgo/go/strings/example_test.go
@@ -247,14 +247,23 @@ func ExampleSplitAfterN() {
}
func ExampleTitle() {
+ // Compare this example to the ToTitle example.
fmt.Println(strings.Title("her royal highness"))
- // Output: Her Royal Highness
+ fmt.Println(strings.Title("loud noises"))
+ fmt.Println(strings.Title("хлеб"))
+ // Output:
+ // Her Royal Highness
+ // Loud Noises
+ // Хлеб
}
func ExampleToTitle() {
+ // Compare this example to the Title example.
+ fmt.Println(strings.ToTitle("her royal highness"))
fmt.Println(strings.ToTitle("loud noises"))
fmt.Println(strings.ToTitle("хлеб"))
// Output:
+ // HER ROYAL HIGHNESS
// LOUD NOISES
// ХЛЕБ
}
diff --git a/libgo/go/strings/replace.go b/libgo/go/strings/replace.go
index ccab1fb..e28d428 100644
--- a/libgo/go/strings/replace.go
+++ b/libgo/go/strings/replace.go
@@ -25,7 +25,8 @@ type replacer interface {
// NewReplacer returns a new Replacer from a list of old, new string
// pairs. Replacements are performed in the order they appear in the
-// target string, without overlapping matches.
+// target string, without overlapping matches. The old string
+// comparisons are done in argument order.
//
// NewReplacer panics if given an odd number of arguments.
func NewReplacer(oldnew ...string) *Replacer {
diff --git a/libgo/go/strings/strings.go b/libgo/go/strings/strings.go
index 7337481..cee315c 100644
--- a/libgo/go/strings/strings.go
+++ b/libgo/go/strings/strings.go
@@ -610,7 +610,8 @@ func ToLower(s string) string {
return Map(unicode.ToLower, s)
}
-// ToTitle returns a copy of the string s with all Unicode letters mapped to their title case.
+// ToTitle returns a copy of the string s with all Unicode letters mapped to
+// their Unicode title case.
func ToTitle(s string) string { return Map(unicode.ToTitle, s) }
// ToUpperSpecial returns a copy of the string s with all Unicode letters mapped to their
@@ -626,7 +627,7 @@ func ToLowerSpecial(c unicode.SpecialCase, s string) string {
}
// ToTitleSpecial returns a copy of the string s with all Unicode letters mapped to their
-// title case, giving priority to the special casing rules.
+// Unicode title case, giving priority to the special casing rules.
func ToTitleSpecial(c unicode.SpecialCase, s string) string {
return Map(c.ToTitle, s)
}
@@ -707,7 +708,7 @@ func isSeparator(r rune) bool {
}
// Title returns a copy of the string s with all Unicode letters that begin words
-// mapped to their title case.
+// mapped to their Unicode title case.
//
// BUG(rsc): The rule Title uses for word boundaries does not handle Unicode punctuation properly.
func Title(s string) string {