通常情况下,我们定义Tab、换行和空格字符是"空白字符" Usually, tab, line break and white space are the special blank words, called 'SpaceChar' 使用IOReader读写每一行, 并移除空白字符
(buf *bufio.Reader)
| 19 | |
| 20 | // 使用IOReader读写每一行, 并移除空白字符 |
| 21 | func readLineAndRemoveSpaceChar(buf *bufio.Reader) (string, error) { |
| 22 | line, isContinue, err := buf.ReadLine() |
| 23 | for isContinue && err == nil { |
| 24 | var next []byte |
| 25 | next, isContinue, err = buf.ReadLine() |
| 26 | line = append(line, next...) |
| 27 | } |
| 28 | return removeSpaceChar(string(line)), err |
| 29 | } |
| 30 | |
| 31 | // 移除空白字符 |
| 32 | // Remove the special blank words in a string |
no test coverage detected