We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a4553fd commit f2864b0Copy full SHA for f2864b0
rpc/cc/arduino/cli/commands/v1/search.go
@@ -15,14 +15,17 @@
15
16
package commands
17
18
-import "strings"
+import (
19
+ "strings"
20
+ "unicode"
21
+)
22
23
// SearchTermsFromQueryString returns the terms inside the query string.
24
// All non alphanumeric characters (expect ':') are considered separators.
25
// All search terms are converted to lowercase.
26
func SearchTermsFromQueryString(query string) []string {
27
// Split on anything but 0-9, a-z or :
28
return strings.FieldsFunc(strings.ToLower(query), func(r rune) bool {
- return !((r >= '0' && r <= '9') || (r >= 'a' && r <= 'z') || r == ':')
29
+ return !unicode.IsLetter(r) && !unicode.IsNumber(r) && r != ':'
30
})
31
}
0 commit comments