FindStartOfPreviousWordUntilSeparator is almost the same as FindStartOfPreviousWord. But this can specify Separator. Return 0 if nothing was found.
(sep string)
| 155 | // FindStartOfPreviousWordUntilSeparator is almost the same as FindStartOfPreviousWord. |
| 156 | // But this can specify Separator. Return 0 if nothing was found. |
| 157 | func (d *Document) FindStartOfPreviousWordUntilSeparator(sep string) int { |
| 158 | if sep == "" { |
| 159 | return d.FindStartOfPreviousWord() |
| 160 | } |
| 161 | |
| 162 | x := d.TextBeforeCursor() |
| 163 | i := strings.LastIndexAny(x, sep) |
| 164 | if i != -1 { |
| 165 | return i + 1 |
| 166 | } |
| 167 | return 0 |
| 168 | } |
| 169 | |
| 170 | // FindStartOfPreviousWordUntilSeparatorIgnoreNextToCursor is almost the same as FindStartOfPreviousWordWithSpace. |
| 171 | // But this can specify Separator. Return 0 if nothing was found. |