TrimNewline trims any final "\n" byte from the end of the buffer.
()
| 131 | |
| 132 | // TrimNewline trims any final "\n" byte from the end of the buffer. |
| 133 | func (b *Buffer) TrimNewline() { |
| 134 | if i := len(b.bs) - 1; i >= 0 { |
| 135 | if b.bs[i] == '\n' { |
| 136 | b.bs = b.bs[:i] |
| 137 | } |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | // Free returns the Buffer to its Pool. |
| 142 | // |