2013-04-11 01:07:29 -07:00
|
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
|
"fmt"
|
|
|
|
|
|
"strings"
|
|
|
|
|
|
"unicode"
|
|
|
|
|
|
"unicode/utf8"
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
|
|
show("alphaBETA")
|
|
|
|
|
|
show("alpha BETA")
|
2014-01-17 05:32:22 +00:00
|
|
|
|
// Three digraphs that should render similar to DZ, Lj, and nj.
|
|
|
|
|
|
show("DŽLjnj")
|
|
|
|
|
|
// Unicode apostrophe in third word.
|
|
|
|
|
|
show("o'hare O'HARE o’hare don't")
|
2013-04-11 01:07:29 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func show(s string) {
|
2014-01-17 05:32:22 +00:00
|
|
|
|
fmt.Println("\nstring: ",
|
|
|
|
|
|
s, " len:", utf8.RuneCountInString(s), "runes") // DZLjnj
|
2013-04-11 01:07:29 -07:00
|
|
|
|
fmt.Println("All upper case: ", strings.ToUpper(s)) // DZLJNJ
|
|
|
|
|
|
fmt.Println("All lower case: ", strings.ToLower(s)) // dzljnj
|
|
|
|
|
|
fmt.Println("All title case: ", strings.ToTitle(s)) // DzLjNj
|
2014-01-17 05:32:22 +00:00
|
|
|
|
fmt.Println("Title words: ", strings.Title(s)) // Dzljnj
|
|
|
|
|
|
fmt.Println("Swapping case: ", // DzLjNJ
|
|
|
|
|
|
strings.Map(unicode.SimpleFold, s))
|
2013-04-11 01:07:29 -07:00
|
|
|
|
}
|