Skip to content

Commit 3973363

Browse files
committed
20220321
1 parent 758c541 commit 3973363

File tree

3 files changed

+21
-28
lines changed

3 files changed

+21
-28
lines changed

README.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,9 @@
2424

2525
[第08章 Map与工厂模式,在Go语言中实现Set](https://github.com/java-aodeng/golang-examples/blob/master/go-08/map_ext_test.go)
2626

27-
第09章 字符串
27+
[第09章 字符串](https://github.com/java-aodeng/golang-examples/blob/master/go-09/string_test.go)
2828

29-
第10章 Go与语言的函数
30-
31-
第11章 可变参数和defer
29+
[第10章 Go与语言的函数 第11章 可变参数和defer](https://github.com/java-aodeng/golang-examples/blob/master/go-10/func_test.go)
3230

3331
第12章 行为的定义和实现
3432

go-09/string_fun_test.go

-24
This file was deleted.

go-09/string_test.go

+19
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package go_09
22

33
import (
4+
"strconv"
5+
"strings"
46
"testing"
57
)
68

@@ -30,3 +32,20 @@ func TestStringToRune(t *testing.T) {
3032
t.Logf("%[1]c %[1]x", c)
3133
}
3234
}
35+
36+
func TestStringFn(t *testing.T) {
37+
s := "A,B,C"
38+
parts := strings.Split(s, ",")
39+
for _, part := range parts {
40+
t.Log(part)
41+
}
42+
t.Log(strings.Join(parts, "-"))
43+
}
44+
45+
func TestConv(t *testing.T) {
46+
s := strconv.Itoa(10)
47+
t.Log("str" + s)
48+
if i, err := strconv.Atoi("10"); err == nil {
49+
t.Log(10 + i)
50+
}
51+
}

0 commit comments

Comments
 (0)