]> Cypherpunks repositories - gostls13.git/commitdiff
bytes: add examples for ToTitleSpecial, ToUpperSpecial and ToLowerSpecial
authorKetan Parmar <ketanbparmar@gmail.com>
Fri, 8 Feb 2019 06:28:23 +0000 (11:58 +0530)
committerAndrew Bonventre <andybons@golang.org>
Fri, 1 Mar 2019 14:56:41 +0000 (14:56 +0000)
Change-Id: If700a150492181f68e23e90ef829ff9eaf7ca7b5
Reviewed-on: https://go-review.googlesource.com/c/161737
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
src/bytes/example_test.go

index 6d328378fabdc48a99aff201905487aa12131521..5ba7077c1de8532ada65dbef0980f501bcd17e2d 100644 (file)
@@ -365,6 +365,16 @@ func ExampleToTitle() {
        // ХЛЕБ
 }
 
+func ExampleToTitleSpecial() {
+       str := []byte("ahoj vývojári golang")
+       totitle := bytes.ToTitleSpecial(unicode.AzeriCase, str)
+       fmt.Println("Original : " + string(str))
+       fmt.Println("ToTitle : " + string(totitle))
+       // Output:
+       // Original : ahoj vývojári golang
+       // ToTitle : AHOJ VÝVOJÁRİ GOLANG
+}
+
 func ExampleTrim() {
        fmt.Printf("[%q]", bytes.Trim([]byte(" !!! Achtung! Achtung! !!! "), "! "))
        // Output: ["Achtung! Achtung"]
@@ -438,11 +448,31 @@ func ExampleToUpper() {
        // Output: GOPHER
 }
 
+func ExampleToUpperSpecial() {
+       str := []byte("ahoj vývojári golang")
+       totitle := bytes.ToUpperSpecial(unicode.AzeriCase, str)
+       fmt.Println("Original : " + string(str))
+       fmt.Println("ToUpper : " + string(totitle))
+       // Output:
+       // Original : ahoj vývojári golang
+       // ToUpper : AHOJ VÝVOJÁRİ GOLANG
+}
+
 func ExampleToLower() {
        fmt.Printf("%s", bytes.ToLower([]byte("Gopher")))
        // Output: gopher
 }
 
+func ExampleToLowerSpecial() {
+       str := []byte("AHOJ VÝVOJÁRİ GOLANG")
+       totitle := bytes.ToLowerSpecial(unicode.AzeriCase, str)
+       fmt.Println("Original : " + string(str))
+       fmt.Println("ToLower : " + string(totitle))
+       // Output:
+       // Original : AHOJ VÝVOJÁRİ GOLANG
+       // ToLower : ahoj vývojári golang
+}
+
 func ExampleReader_Len() {
        fmt.Println(bytes.NewReader([]byte("Hi!")).Len())
        fmt.Println(bytes.NewReader([]byte("こんにちは!")).Len())