Replaces the regexp with calls to strings.ReplaceAll and strings.Fields
for simplicity and improved performance.
Signed-off-by: Dave Henderson <dave.henderson@grafana.com>
(cherry picked from commit 1f85101787)
Co-authored-by: Dave Henderson <dave.henderson@grafana.com>
This commit is contained in:
co-authored by
Dave Henderson
parent
1a69cc5b21
commit
0726a56956
+1
-2
@@ -3,7 +3,6 @@ package util
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
"unicode"
|
||||
@@ -34,7 +33,7 @@ func SplitString(str string) []string {
|
||||
return []string{}
|
||||
}
|
||||
|
||||
return regexp.MustCompile("[, ]+").Split(str, -1)
|
||||
return strings.Fields(strings.ReplaceAll(str, ",", " "))
|
||||
}
|
||||
|
||||
// GetAgeString returns a string representing certain time from years to minutes.
|
||||
|
||||
Reference in New Issue
Block a user