Golang strings.ToLowerSpecial() 函数及示例
strings.ToLowerSpecial() 函数 在 Golang 中用于返回字符串 s 的副本,其中所有 Unicode 字母都使用由 c 指定的大小写映射映射到它们的小写形式。
语法:
func ToLowerSpecial(c unicode.SpecialCase, s string) string
在此,c 是大小写映射,s 是指定的字符串。
示例 1:
// Golang 程序,演示
// strings.ToLowerSpecial 函数
package main
import (
"fmt"
"strings"
"unicode"
)
func main() {
// 使用该函数
fmt.Println(strings.ToLowerSpecial(unicode.TurkishCase, "Hello, Geeks"))
}
输出:
hello, geeks
示例 2:
// Golang 程序,演示
// strings.ToLowerSpecial 函数
package main
import (
"fmt"
"strings"
"unicode"
)
func main() {
// 使用该函数
fmt.Println(strings.ToLowerSpecial(unicode.TurkishCase, "Computer Portal"))
}
输出:
computer portal