-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UWordBoundIndices
doesn't expose the indices
#35
Comments
Oh, is it just that the docs at https://unicode-rs.github.io/unicode-segmentation/unicode_segmentation/struct.UWordBoundIndices.html are stale? |
The Graphemes suffered the same issue prior to the introduction of a cursor API in #21, and I suppose that word segmentation could be similarly updated. |
The problem I had was that that critical portion of the docs on that page:
is buried a bit further down in the page (that's just how they render), so I was left to fixate on the
I would love to have an API directed at random access! I have this somewhat clunky solution for the moment:
|
Yep, it can be pretty easy to miss things. Trait impls often look a bit lost in the rendered page, and the convention established by the standard library is that the behavior of iterators is documented on their builder method rather than the
I'd be happy to work on it, but before that I wouldn't mind seeing some consolidation between the |
As far as I can tell,
UWordBoundIndices
is just a wrapper aroundUWordBounds
with an identical interface.In my use case I have a line of text and an index into the
.chars()
of that string from a mouse double click and I need to obtain the indices of the start and end of the word that enclose that index.It seemed to me that
UWordBoundIndices
is what I'd want here, but I don't see how to use it for this purpose. Is this an oversight, or is there a better way to do get the result I'd like?The text was updated successfully, but these errors were encountered: