FindEndOfCurrentWordUntilSeparator is almost the same as FindEndOfCurrentWord. But this can specify Separator. Return 0 if nothing was found.
(sep string)
| 218 | // FindEndOfCurrentWordUntilSeparator is almost the same as FindEndOfCurrentWord. |
| 219 | // But this can specify Separator. Return 0 if nothing was found. |
| 220 | func (d *Document) FindEndOfCurrentWordUntilSeparator(sep string) int { |
| 221 | if sep == "" { |
| 222 | return d.FindEndOfCurrentWord() |
| 223 | } |
| 224 | |
| 225 | x := d.TextAfterCursor() |
| 226 | i := strings.IndexAny(x, sep) |
| 227 | if i != -1 { |
| 228 | return i |
| 229 | } |
| 230 | return len(x) |
| 231 | } |
| 232 | |
| 233 | // FindEndOfCurrentWordUntilSeparatorIgnoreNextToCursor is almost the same as FindEndOfCurrentWordWithSpace. |
| 234 | // But this can specify Separator. Return 0 if nothing was found. |