Skip to content

Commit

Permalink
This avoid unnecessary byte/string conversion (qax-os#1541)
Browse files Browse the repository at this point in the history
Signed-off-by: Eng Zer Jun <[email protected]>
  • Loading branch information
Juneezee authored May 22, 2023
1 parent 91471f9 commit d409289
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion numfmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,7 @@ func printCommaSep(text string) string {
if i > 0 && (length-i)%3 == 0 {
target.WriteString(",")
}
target.WriteString(string(text[i]))
target.WriteByte(text[i])
}
if len(subStr) == 2 {
target.WriteString(".")
Expand Down
6 changes: 3 additions & 3 deletions table.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ func (f *File) parseFilterExpression(expression string, tokens []string) ([]int,
// expressions).
conditional := 0
c := tokens[3]
if conditionFormat.Match([]byte(c)) {
if conditionFormat.MatchString(c) {
conditional = 1
}
expression1, token1, err := f.parseFilterTokens(expression, tokens[:3])
Expand Down Expand Up @@ -538,7 +538,7 @@ func (f *File) parseFilterTokens(expression string, tokens []string) ([]int, str
}
token := tokens[2]
// Special handling for Blanks/NonBlanks.
re := blankFormat.Match([]byte(strings.ToLower(token)))
re := blankFormat.MatchString((strings.ToLower(token)))
if re {
// Only allow Equals or NotEqual in this context.
if operator != 2 && operator != 5 {
Expand All @@ -563,7 +563,7 @@ func (f *File) parseFilterTokens(expression string, tokens []string) ([]int, str
}
// If the string token contains an Excel match character then change the
// operator type to indicate a non "simple" equality.
re = matchFormat.Match([]byte(token))
re = matchFormat.MatchString(token)
if operator == 2 && re {
operator = 22
}
Expand Down

0 comments on commit d409289

Please sign in to comment.