ToTitle
ToTitle 返回将所有字母都转为对应的标题版本的拷贝。
ToTitle
函数定义
func ToTitle(s string) string
代码示例
package main
import (
"fmt"
"strings"
)
func main() {
// 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
// ХЛЕБ