Made conditions for word boundary a little more relaxed
This commit is contained in:
2
misc.go
2
misc.go
@@ -24,7 +24,7 @@ func dotChars() []rune { // Returns all possible characters represented by the d
|
||||
// Returns true if str[idx] and str[idx-1] are separated by a word boundary.
|
||||
func isWordBoundary(str []rune, idx int) bool {
|
||||
wbounded := idx == 0 ||
|
||||
idx == len(str)-1 ||
|
||||
idx >= len(str)-1 ||
|
||||
(!slices.Contains(wordChars, str[idx-1]) && slices.Contains(wordChars, str[idx])) ||
|
||||
(slices.Contains(wordChars, str[idx-1]) && !slices.Contains(wordChars, str[idx]))
|
||||
return wbounded
|
||||
|
Reference in New Issue
Block a user