|
@@ -9,7 +9,6 @@ import (
|
|
|
"io"
|
|
|
"math"
|
|
|
"reflect"
|
|
|
- "regexp"
|
|
|
"strings"
|
|
|
"unicode/utf16"
|
|
|
"unicode/utf8"
|
|
@@ -30,10 +29,6 @@ var (
|
|
|
InvalidRuneError = errors.New("Invalid rune")
|
|
|
)
|
|
|
|
|
|
-var (
|
|
|
- unicodeTrimRegexp = regexp.MustCompile("^[" + parser.WhitespaceChars + "]*(.*?)[" + parser.WhitespaceChars + "]*$")
|
|
|
-)
|
|
|
-
|
|
|
func (rr runeReaderReplace) ReadRune() (r rune, size int, err error) {
|
|
|
r, size, err = rr.wrapped.ReadRune()
|
|
|
if err == InvalidRuneError {
|
|
@@ -96,7 +91,7 @@ func (s unicodeString) toTrimmedUTF8() string {
|
|
|
if len(s) == 0 {
|
|
|
return ""
|
|
|
}
|
|
|
- return unicodeTrimRegexp.FindStringSubmatch(s.String())[1]
|
|
|
+ return strings.Trim(s.String(), parser.WhitespaceChars)
|
|
|
}
|
|
|
|
|
|
func (s unicodeString) ToNumber() Value {
|