modified: eBook/18.1.md

This commit is contained in:
songleo
2016-01-02 20:33:39 +08:00
parent e44f5d7257
commit 3eb5cb5496

View File

@@ -29,15 +29,18 @@ for ix, ch := range str {
```
4如何获取一个字符串的字节数`len(str)`
如何获取一个字符串的字符数:
最快速:`utf8.RuneCountInString(str)`
`len([]int(str)) //TBD`
5如何连接字符串
最快速: `with a bytes.Buffer`(参考[章节7.2](7.2.md)
`Strings.Join()`(参考[章节4.7](4.7.md)
最快速: `with a bytes.Buffer`(参考[章节7.2](07.2.md)
`Strings.Join()`(参考[章节4.7](04.7.md)
`+=`
@@ -47,12 +50,12 @@ for ix, ch := range str {
str1 += str2 //str1 == "Hello World!"
```
6如何解析命令行参数使用os或者flag包
6如何解析命令行参数使用`os`或者`flag`
(参考[例12.4](examples/chapter_12/fileinput.go)
## 链接
- [目录](directory.md)
- 上一[出于性能考虑的实用代码片段](18.0.md)
- 上一[出于性能考虑的实用代码片段](18.0.md)
- 下一节:[数组和切片](18.2.md)