Skip to content

Commit 1f3d38f

Browse files
kpbirdandybons
authored andcommitted
bytes: add examples for ToTitleSpecial, ToUpperSpecial and ToLowerSpecial
Change-Id: If700a150492181f68e23e90ef829ff9eaf7ca7b5 Reviewed-on: https://go-review.googlesource.com/c/161737 Run-TryBot: Andrew Bonventre <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Andrew Bonventre <[email protected]>
1 parent 44d3bb9 commit 1f3d38f

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/bytes/example_test.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,16 @@ func ExampleToTitle() {
365365
// ХЛЕБ
366366
}
367367

368+
func ExampleToTitleSpecial() {
369+
str := []byte("ahoj vývojári golang")
370+
totitle := bytes.ToTitleSpecial(unicode.AzeriCase, str)
371+
fmt.Println("Original : " + string(str))
372+
fmt.Println("ToTitle : " + string(totitle))
373+
// Output:
374+
// Original : ahoj vývojári golang
375+
// ToTitle : AHOJ VÝVOJÁRİ GOLANG
376+
}
377+
368378
func ExampleTrim() {
369379
fmt.Printf("[%q]", bytes.Trim([]byte(" !!! Achtung! Achtung! !!! "), "! "))
370380
// Output: ["Achtung! Achtung"]
@@ -438,11 +448,31 @@ func ExampleToUpper() {
438448
// Output: GOPHER
439449
}
440450

451+
func ExampleToUpperSpecial() {
452+
str := []byte("ahoj vývojári golang")
453+
totitle := bytes.ToUpperSpecial(unicode.AzeriCase, str)
454+
fmt.Println("Original : " + string(str))
455+
fmt.Println("ToUpper : " + string(totitle))
456+
// Output:
457+
// Original : ahoj vývojári golang
458+
// ToUpper : AHOJ VÝVOJÁRİ GOLANG
459+
}
460+
441461
func ExampleToLower() {
442462
fmt.Printf("%s", bytes.ToLower([]byte("Gopher")))
443463
// Output: gopher
444464
}
445465

466+
func ExampleToLowerSpecial() {
467+
str := []byte("AHOJ VÝVOJÁRİ GOLANG")
468+
totitle := bytes.ToLowerSpecial(unicode.AzeriCase, str)
469+
fmt.Println("Original : " + string(str))
470+
fmt.Println("ToLower : " + string(totitle))
471+
// Output:
472+
// Original : AHOJ VÝVOJÁRİ GOLANG
473+
// ToLower : ahoj vývojári golang
474+
}
475+
446476
func ExampleReader_Len() {
447477
fmt.Println(bytes.NewReader([]byte("Hi!")).Len())
448478
fmt.Println(bytes.NewReader([]byte("こんにちは!")).Len())

0 commit comments

Comments
 (0)