fmt.Scanln()不是读取一行, 而是遇到换行就停止,
Scanln is similar to Scan, but stops scanning at a newline and after the final item there must be a newline or EOF.
举个例子:
var i, j, k int
fmt.Scanln(&i, &j, &k)
fmt.Println(i, j, k) 输入1, 2 回车后程序结束. 如果换成fmt.Scan()还会让输入的.
使用stdin与read
2014-03-03 17:11:27
1292
0
0
2014-03-02 21:48:14
1308
0
0
首先得到一个regexp, 使用Compile(), (MustCompile()如果字符串不符合正则会panic)
再调用其它函数, 常用的有
检测是否匹配 Match() bool 检测是否存在, 并返回匹配的字符串 Find(), FindAll(), 每一种都有String类型的相应函数, FindString(), FindAllString() 检测子匹配, FindStringSubMatch(), FindAllStringSubMatch()... 查找并替换, ReplaceAllString() 分隔成数组, Split(),
2014-03-01 16:12:13
2142
0
0
2014-03-01 15:34:53
4658
1
0
2014-02-27 11:18:53
2931
0
0
2014-02-22 21:11:18
686
0
0