MCPcopy Index your code
hub / github.com/bpython/bpython / last_word_pos

Function last_word_pos

bpython/curtsiesfrontend/manual_readline.py:209–213  ·  view source on GitHub ↗

returns the start index of the last word of given string

(string)

Source from the content-addressed store, hash-verified

207
208
209def last_word_pos(string):
210 """returns the start index of the last word of given string"""
211 match = forward_word_re.search(string[::-1])
212 index = match and len(string) - match.end() + 1
213 return index or 0
214
215
216@edit_keys.on("<Esc+b>")

Callers 3

test_last_word_posMethod · 0.90
back_wordFunction · 0.85

Calls 1

searchMethod · 0.80

Tested by 2

test_last_word_posMethod · 0.72