Replaced isAlphaNum() with isNormalChar(), which returns true if the character isn't special (also returns true for unicode characters, which the previous function didn't
This commit is contained in:
7
misc.go
7
misc.go
@@ -2,7 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"slices"
|
||||
"unicode"
|
||||
)
|
||||
|
||||
var whitespaceChars = []rune{' ', '\t', '\n'}
|
||||
@@ -33,8 +32,10 @@ func isWordBoundary(str []rune, idx int) bool {
|
||||
return wbounded
|
||||
}
|
||||
|
||||
func isAlphaNum(c rune) bool {
|
||||
return unicode.IsLetter(c) || unicode.IsNumber(c)
|
||||
func isNormalChar(c rune) bool {
|
||||
specialChars := []rune(`?*\^${}()+|[].~`)
|
||||
specialChars = append(specialChars, LBRACKET, RBRACKET)
|
||||
return !slices.Contains(specialChars, c)
|
||||
}
|
||||
|
||||
func assert(cond bool) {
|
||||
|
Reference in New Issue
Block a user