diff --git a/docs/convertor.md b/docs/convertor.md index 7084360..b49fc56 100644 --- a/docs/convertor.md +++ b/docs/convertor.md @@ -652,45 +652,45 @@ import ( func main() { type Struct struct { - Str string - Int int - Float float64 - Bool bool - Nil interface{} - unexported string - } + Str string + Int int + Float float64 + Bool bool + Nil interface{} + unexported string + } - cases := []interface{}{ - true, - 1, - 0.1, - map[string]int{ - "a": 1, - "b": 2, - }, - &Struct{ - Str: "test", - Int: 1, - Float: 0.1, - Bool: true, - Nil: nil, - // unexported: "can't be cloned", - }, - } + cases := []interface{}{ + true, + 1, + 0.1, + map[string]int{ + "a": 1, + "b": 2, + }, + &Struct{ + Str: "test", + Int: 1, + Float: 0.1, + Bool: true, + Nil: nil, + // unexported: "can't be cloned", + }, + } - for _, item := range cases { - cloned := convertor.DeepClone(item) + for _, item := range cases { + cloned := convertor.DeepClone(item) - isPointerEqual := &cloned == &item - fmt.Println(cloned, isPointerEqual) - } + isPointerEqual := &cloned == &item + fmt.Println(cloned, isPointerEqual) + } - // Output: - // true false - // 1 false - // 0.1 false - // map[a:1 b:2] false - // &{test 1 0.1 true } false + // Output: + // true false + // 1 false + // 0.1 false + // map[a:1 b:2] false + // &{test 1 0.1 true } false } ``` @@ -717,43 +717,43 @@ import ( func main() { type Address struct { - Country string - ZipCode string - } + Country string + ZipCode string + } - type User struct { - Name string - Age int - Role string - Addr Address - Hobbys []string - salary int - } + type User struct { + Name string + Age int + Role string + Addr Address + Hobbys []string + salary int + } - type Employee struct { - Name string - Age int - Role string - Addr Address - Hobbys []string - salary int - } + type Employee struct { + Name string + Age int + Role string + Addr Address + Hobbys []string + salary int + } - user := User{Name: "user001", Age: 10, Role: "Admin", Addr: Address{Country: "CN", ZipCode: "001"}, Hobbys: []string{"a", "b"}, salary: 1000} + user := User{Name: "user001", Age: 10, Role: "Admin", Addr: Address{Country: "CN", ZipCode: "001"}, Hobbys: []string{"a", "b"}, salary: 1000} - employee1 := Employee{} - CopyProperties(&employee1, &user) + employee1 := Employee{} + CopyProperties(&employee1, &user) - employee2 := Employee{Name: "employee001", Age: 20, Role: "User", - Addr: Address{Country: "UK", ZipCode: "002"}, salary: 500} + employee2 := Employee{Name: "employee001", Age: 20, Role: "User", + Addr: Address{Country: "UK", ZipCode: "002"}, salary: 500} - CopyProperties(&employee2, &user) + CopyProperties(&employee2, &user) - fmt.Println(employee1) - fmt.Println(employee2) + fmt.Println(employee1) + fmt.Println(employee2) - // Output: - // {user001 10 Admin {CN 001} [a b] 0} - // {user001 10 Admin {CN 001} [a b] 500} + // Output: + // {user001 10 Admin {CN 001} [a b] 0} + // {user001 10 Admin {CN 001} [a b] 500} } ``` \ No newline at end of file diff --git a/docs/convertor_zh-CN.md b/docs/convertor_zh-CN.md index 17220b1..9257092 100644 --- a/docs/convertor_zh-CN.md +++ b/docs/convertor_zh-CN.md @@ -652,45 +652,45 @@ import ( func main() { type Struct struct { - Str string - Int int - Float float64 - Bool bool - Nil interface{} - unexported string - } + Str string + Int int + Float float64 + Bool bool + Nil interface{} + unexported string + } - cases := []interface{}{ - true, - 1, - 0.1, - map[string]int{ - "a": 1, - "b": 2, - }, - &Struct{ - Str: "test", - Int: 1, - Float: 0.1, - Bool: true, - Nil: nil, - // unexported: "can't be cloned", - }, - } + cases := []interface{}{ + true, + 1, + 0.1, + map[string]int{ + "a": 1, + "b": 2, + }, + &Struct{ + Str: "test", + Int: 1, + Float: 0.1, + Bool: true, + Nil: nil, + // unexported: "can't be cloned", + }, + } - for _, item := range cases { - cloned := convertor.DeepClone(item) + for _, item := range cases { + cloned := convertor.DeepClone(item) - isPointerEqual := &cloned == &item - fmt.Println(cloned, isPointerEqual) - } + isPointerEqual := &cloned == &item + fmt.Println(cloned, isPointerEqual) + } - // Output: - // true false - // 1 false - // 0.1 false - // map[a:1 b:2] false - // &{test 1 0.1 true } false + // Output: + // true false + // 1 false + // 0.1 false + // map[a:1 b:2] false + // &{test 1 0.1 true } false } ``` @@ -716,43 +716,43 @@ import ( func main() { type Address struct { - Country string - ZipCode string - } + Country string + ZipCode string + } - type User struct { - Name string - Age int - Role string - Addr Address - Hobbys []string - salary int - } + type User struct { + Name string + Age int + Role string + Addr Address + Hobbys []string + salary int + } - type Employee struct { - Name string - Age int - Role string - Addr Address - Hobbys []string - salary int - } + type Employee struct { + Name string + Age int + Role string + Addr Address + Hobbys []string + salary int + } - user := User{Name: "user001", Age: 10, Role: "Admin", Addr: Address{Country: "CN", ZipCode: "001"}, Hobbys: []string{"a", "b"}, salary: 1000} + user := User{Name: "user001", Age: 10, Role: "Admin", Addr: Address{Country: "CN", ZipCode: "001"}, Hobbys: []string{"a", "b"}, salary: 1000} - employee1 := Employee{} - CopyProperties(&employee1, &user) + employee1 := Employee{} + CopyProperties(&employee1, &user) - employee2 := Employee{Name: "employee001", Age: 20, Role: "User", - Addr: Address{Country: "UK", ZipCode: "002"}, salary: 500} + employee2 := Employee{Name: "employee001", Age: 20, Role: "User", + Addr: Address{Country: "UK", ZipCode: "002"}, salary: 500} - CopyProperties(&employee2, &user) + CopyProperties(&employee2, &user) - fmt.Println(employee1) - fmt.Println(employee2) + fmt.Println(employee1) + fmt.Println(employee2) - // Output: - // {user001 10 Admin {CN 001} [a b] 0} - // {user001 10 Admin {CN 001} [a b] 500} + // Output: + // {user001 10 Admin {CN 001} [a b] 0} + // {user001 10 Admin {CN 001} [a b] 500} } ``` \ No newline at end of file diff --git a/docs/strutil.md b/docs/strutil.md index e19b741..6821a12 100644 --- a/docs/strutil.md +++ b/docs/strutil.md @@ -472,28 +472,28 @@ import ( func main() { result1 := strutil.Pad("foo", 1, "bar") - result2 := strutil.Pad("foo", 2, "bar") - result3 := strutil.Pad("foo", 3, "bar") - result4 := strutil.Pad("foo", 4, "bar") - result5 := strutil.Pad("foo", 5, "bar") - result6 := strutil.Pad("foo", 6, "bar") - result7 := strutil.Pad("foo", 7, "bar") + result2 := strutil.Pad("foo", 2, "bar") + result3 := strutil.Pad("foo", 3, "bar") + result4 := strutil.Pad("foo", 4, "bar") + result5 := strutil.Pad("foo", 5, "bar") + result6 := strutil.Pad("foo", 6, "bar") + result7 := strutil.Pad("foo", 7, "bar") - fmt.Println(result1) - fmt.Println(result2) - fmt.Println(result3) - fmt.Println(result4) - fmt.Println(result5) - fmt.Println(result6) - fmt.Println(result7) - // Output: - // foo - // foo - // foo - // foob - // bfoob - // bfooba - // bafooba + fmt.Println(result1) + fmt.Println(result2) + fmt.Println(result3) + fmt.Println(result4) + fmt.Println(result5) + fmt.Println(result6) + fmt.Println(result7) + // Output: + // foo + // foo + // foo + // foob + // bfoob + // bfooba + // bafooba } ``` @@ -872,26 +872,26 @@ import ( func main() { result1 := strutil.SplitWords("a word") - result2 := strutil.SplitWords("I'am a programmer") - result3 := strutil.SplitWords("Bonjour, je suis programmeur") - result4 := strutil.SplitWords("a -b-c' 'd'e") - result5 := strutil.SplitWords("你好,我是一名码农") - result6 := strutil.SplitWords("こんにちは,私はプログラマーです") + result2 := strutil.SplitWords("I'am a programmer") + result3 := strutil.SplitWords("Bonjour, je suis programmeur") + result4 := strutil.SplitWords("a -b-c' 'd'e") + result5 := strutil.SplitWords("你好,我是一名码农") + result6 := strutil.SplitWords("こんにちは,私はプログラマーです") - fmt.Println(result1) - fmt.Println(result2) - fmt.Println(result3) - fmt.Println(result4) - fmt.Println(result5) - fmt.Println(result6) + fmt.Println(result1) + fmt.Println(result2) + fmt.Println(result3) + fmt.Println(result4) + fmt.Println(result5) + fmt.Println(result6) - // Output: - // [a word] - // [I'am a programmer] - // [Bonjour je suis programmeur] - // [a b-c' d'e] - // [] - // [] + // Output: + // [a word] + // [I'am a programmer] + // [Bonjour je suis programmeur] + // [a b-c' d'e] + // [] + // [] } ``` @@ -916,25 +916,25 @@ import ( func main() { result1 := strutil.WordCount("a word") - result2 := strutil.WordCount("I'am a programmer") - result3 := strutil.WordCount("Bonjour, je suis programmeur") - result4 := strutil.WordCount("a -b-c' 'd'e") - result5 := strutil.WordCount("你好,我是一名码农") - result6 := strutil.WordCount("こんにちは,私はプログラマーです") + result2 := strutil.WordCount("I'am a programmer") + result3 := strutil.WordCount("Bonjour, je suis programmeur") + result4 := strutil.WordCount("a -b-c' 'd'e") + result5 := strutil.WordCount("你好,我是一名码农") + result6 := strutil.WordCount("こんにちは,私はプログラマーです") - fmt.Println(result1) - fmt.Println(result2) - fmt.Println(result3) - fmt.Println(result4) - fmt.Println(result5) - fmt.Println(result6) + fmt.Println(result1) + fmt.Println(result2) + fmt.Println(result3) + fmt.Println(result4) + fmt.Println(result5) + fmt.Println(result6) - // Output: - // 2 - // 3 - // 4 - // 3 - // 0 - // 0 + // Output: + // 2 + // 3 + // 4 + // 3 + // 0 + // 0 } ``` \ No newline at end of file diff --git a/docs/strutil_zh-CN.md b/docs/strutil_zh-CN.md index 7d9cd24..623e555 100644 --- a/docs/strutil_zh-CN.md +++ b/docs/strutil_zh-CN.md @@ -471,28 +471,28 @@ import ( func main() { result1 := strutil.Pad("foo", 1, "bar") - result2 := strutil.Pad("foo", 2, "bar") - result3 := strutil.Pad("foo", 3, "bar") - result4 := strutil.Pad("foo", 4, "bar") - result5 := strutil.Pad("foo", 5, "bar") - result6 := strutil.Pad("foo", 6, "bar") - result7 := strutil.Pad("foo", 7, "bar") + result2 := strutil.Pad("foo", 2, "bar") + result3 := strutil.Pad("foo", 3, "bar") + result4 := strutil.Pad("foo", 4, "bar") + result5 := strutil.Pad("foo", 5, "bar") + result6 := strutil.Pad("foo", 6, "bar") + result7 := strutil.Pad("foo", 7, "bar") - fmt.Println(result1) - fmt.Println(result2) - fmt.Println(result3) - fmt.Println(result4) - fmt.Println(result5) - fmt.Println(result6) - fmt.Println(result7) - // Output: - // foo - // foo - // foo - // foob - // bfoob - // bfooba - // bafooba + fmt.Println(result1) + fmt.Println(result2) + fmt.Println(result3) + fmt.Println(result4) + fmt.Println(result5) + fmt.Println(result6) + fmt.Println(result7) + // Output: + // foo + // foo + // foo + // foob + // bfoob + // bfooba + // bafooba } ``` @@ -870,26 +870,26 @@ import ( func main() { result1 := strutil.SplitWords("a word") - result2 := strutil.SplitWords("I'am a programmer") - result3 := strutil.SplitWords("Bonjour, je suis programmeur") - result4 := strutil.SplitWords("a -b-c' 'd'e") - result5 := strutil.SplitWords("你好,我是一名码农") - result6 := strutil.SplitWords("こんにちは,私はプログラマーです") + result2 := strutil.SplitWords("I'am a programmer") + result3 := strutil.SplitWords("Bonjour, je suis programmeur") + result4 := strutil.SplitWords("a -b-c' 'd'e") + result5 := strutil.SplitWords("你好,我是一名码农") + result6 := strutil.SplitWords("こんにちは,私はプログラマーです") - fmt.Println(result1) - fmt.Println(result2) - fmt.Println(result3) - fmt.Println(result4) - fmt.Println(result5) - fmt.Println(result6) + fmt.Println(result1) + fmt.Println(result2) + fmt.Println(result3) + fmt.Println(result4) + fmt.Println(result5) + fmt.Println(result6) - // Output: - // [a word] - // [I'am a programmer] - // [Bonjour je suis programmeur] - // [a b-c' d'e] - // [] - // [] + // Output: + // [a word] + // [I'am a programmer] + // [Bonjour je suis programmeur] + // [a b-c' d'e] + // [] + // [] } ``` @@ -914,25 +914,25 @@ import ( func main() { result1 := strutil.WordCount("a word") - result2 := strutil.WordCount("I'am a programmer") - result3 := strutil.WordCount("Bonjour, je suis programmeur") - result4 := strutil.WordCount("a -b-c' 'd'e") - result5 := strutil.WordCount("你好,我是一名码农") - result6 := strutil.WordCount("こんにちは,私はプログラマーです") + result2 := strutil.WordCount("I'am a programmer") + result3 := strutil.WordCount("Bonjour, je suis programmeur") + result4 := strutil.WordCount("a -b-c' 'd'e") + result5 := strutil.WordCount("你好,我是一名码农") + result6 := strutil.WordCount("こんにちは,私はプログラマーです") - fmt.Println(result1) - fmt.Println(result2) - fmt.Println(result3) - fmt.Println(result4) - fmt.Println(result5) - fmt.Println(result6) + fmt.Println(result1) + fmt.Println(result2) + fmt.Println(result3) + fmt.Println(result4) + fmt.Println(result5) + fmt.Println(result6) - // Output: - // 2 - // 3 - // 4 - // 3 - // 0 - // 0 + // Output: + // 2 + // 3 + // 4 + // 3 + // 0 + // 0 } ``` \ No newline at end of file