diff options
Diffstat (limited to 'src/util')
| -rw-r--r-- | src/util/chars.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/util/chars.go b/src/util/chars.go index 9e58313b..ec6fca0e 100644 --- a/src/util/chars.go +++ b/src/util/chars.go @@ -1,6 +1,7 @@ package util import ( + "fmt" "unicode" "unicode/utf8" "unsafe" @@ -94,6 +95,11 @@ func (chars *Chars) Length() int { return len(chars.slice) } +// String returns the string representation of a Chars object. +func (chars *Chars) String() string { + return fmt.Sprintf("Chars{slice: []byte(%q), inBytes: %v, trimLengthKnown: %v, trimLength: %d, Index: %d}", chars.slice, chars.inBytes, chars.trimLengthKnown, chars.trimLength, chars.Index) +} + // TrimLength returns the length after trimming leading and trailing whitespaces func (chars *Chars) TrimLength() uint16 { if chars.trimLengthKnown { |
