aboutsummaryrefslogtreecommitdiff
path: root/src/bytes
diff options
context:
space:
mode:
authorKetan Parmar <ketanbparmar@gmail.com>2019-02-08 11:58:23 +0530
committerAndrew Bonventre <andybons@golang.org>2019-03-01 14:56:41 +0000
commit1f3d38fdaaff88d7ce711612fbe9b7fc7182efd7 (patch)
tree4139ae43755d945de873a8586ba887192b6546fd /src/bytes
parent44d3bb998ca00e49d9e0138954287af206b614bf (diff)
downloadgo-1f3d38fdaaff88d7ce711612fbe9b7fc7182efd7.tar.gz
go-1f3d38fdaaff88d7ce711612fbe9b7fc7182efd7.zip
bytes: add examples for ToTitleSpecial, ToUpperSpecial and ToLowerSpecial
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>
Diffstat (limited to 'src/bytes')
-rw-r--r--src/bytes/example_test.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/bytes/example_test.go b/src/bytes/example_test.go
index 6d328378fa..5ba7077c1d 100644
--- a/src/bytes/example_test.go
+++ b/src/bytes/example_test.go
@@ -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())