|
|
@ -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.
|
|
|
|
// Returns true if str[idx] and str[idx-1] are separated by a word boundary.
|
|
|
|
func isWordBoundary(str []rune, idx int) bool {
|
|
|
|
func isWordBoundary(str []rune, idx int) bool {
|
|
|
|
wbounded := idx == 0 ||
|
|
|
|
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])) ||
|
|
|
|
(slices.Contains(wordChars, str[idx-1]) && !slices.Contains(wordChars, str[idx]))
|
|
|
|
(slices.Contains(wordChars, str[idx-1]) && !slices.Contains(wordChars, str[idx]))
|
|
|
|
return wbounded
|
|
|
|
return wbounded
|
|
|
|