Skip to content

Commit 85908af

Browse files
Juneezeexuri
authored andcommitted
This avoid unnecessary byte/string conversion (qax-os#1541)
Signed-off-by: Eng Zer Jun <[email protected]>
1 parent 002508b commit 85908af

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

numfmt.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1220,7 +1220,7 @@ func printCommaSep(text string) string {
12201220
if i > 0 && (length-i)%3 == 0 {
12211221
target.WriteString(",")
12221222
}
1223-
target.WriteString(string(text[i]))
1223+
target.WriteByte(text[i])
12241224
}
12251225
if len(subStr) == 2 {
12261226
target.WriteString(".")

table.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ func (f *File) parseFilterExpression(expression string, tokens []string) ([]int,
490490
// expressions).
491491
conditional := 0
492492
c := tokens[3]
493-
if conditionFormat.Match([]byte(c)) {
493+
if conditionFormat.MatchString(c) {
494494
conditional = 1
495495
}
496496
expression1, token1, err := f.parseFilterTokens(expression, tokens[:3])
@@ -538,7 +538,7 @@ func (f *File) parseFilterTokens(expression string, tokens []string) ([]int, str
538538
}
539539
token := tokens[2]
540540
// Special handling for Blanks/NonBlanks.
541-
re := blankFormat.Match([]byte(strings.ToLower(token)))
541+
re := blankFormat.MatchString((strings.ToLower(token)))
542542
if re {
543543
// Only allow Equals or NotEqual in this context.
544544
if operator != 2 && operator != 5 {
@@ -563,7 +563,7 @@ func (f *File) parseFilterTokens(expression string, tokens []string) ([]int, str
563563
}
564564
// If the string token contains an Excel match character then change the
565565
// operator type to indicate a non "simple" equality.
566-
re = matchFormat.Match([]byte(token))
566+
re = matchFormat.MatchString(token)
567567
if operator == 2 && re {
568568
operator = 22
569569
}

0 commit comments

Comments
 (0)