}
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
// ХЛЕБ
}
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
}
// 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)
}
}
// 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 {