Remove trailing whitespaces when using --with-nth

This commit is contained in:
Junegunn Choi
2019-11-12 22:45:25 +09:00
parent 05b5f3f845
commit 751aa1944a
2 changed files with 6 additions and 0 deletions

View File

@@ -142,6 +142,11 @@ func (chars *Chars) TrailingWhitespaces() int {
return whitespaces
}
func (chars *Chars) TrimTrailingWhitespaces() {
whitespaces := chars.TrailingWhitespaces()
chars.slice = chars.slice[0 : len(chars.slice)-whitespaces]
}
func (chars *Chars) ToString() string {
if runes := chars.optionalRunes(); runes != nil {
return string(runes)