alvinlindstam / grapheme

A python package for grapheme aware string handling
MIT License
106 stars 7 forks source link

Support negative indexing in substr, like string slicing #4

Open alvinlindstam opened 7 years ago

alvinlindstam commented 7 years ago

It should be possible to do grapheme.substr(string, -10) to get the last ten graphemes, and the like (like slicing, but function based).

Implementation considerations:

Would probably require traversing through the full string. Is it possible to go backwards until som state that we know would be a break and then only traverse the end from there?