-
Notifications
You must be signed in to change notification settings - Fork 0
/
case.go
33 lines (24 loc) · 1.15 KB
/
case.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package main
import (
"bytes"
"log"
"unicode"
)
func main() {
quickBrownFox := []byte("The quick brown fox jumped over the lazy dog")
title := bytes.Title(quickBrownFox)
log.Printf("Title turned %q into %q", quickBrownFox, title)
allTitle := bytes.ToTitle(quickBrownFox)
log.Printf("ToTitle turned %q to %q", quickBrownFox, allTitle)
allTitleTurkish := bytes.ToTitleSpecial(unicode.TurkishCase, quickBrownFox)
log.Printf("ToTitleSpecial turned %q into %q using the Turkish case rules", quickBrownFox, allTitleTurkish)
lower := bytes.ToLower(title)
log.Printf("ToLower turned %q into %q", title, lower)
turkishCapitalI := []byte("İ")
turkishLowerI := bytes.ToLowerSpecial(unicode.TurkishCase, turkishCapitalI)
log.Printf("ToLowerSpecial turned %q into %q using the Turkish case rules", turkishCapitalI, turkishLowerI)
upper := bytes.ToUpper(quickBrownFox)
log.Printf("ToUpper turned %q to %q", quickBrownFox, upper)
upperSpecial := bytes.ToUpperSpecial(unicode.TurkishCase, quickBrownFox)
log.Printf("ToUpperSpecial turned %q into %q using the Turkish case rules", quickBrownFox, upperSpecial)
}