#How to get character in a &str at byte offset?
8 messages · Page 1 of 1 (latest)
If you need this in more places, create a helper function
Also note the usual: Are you sure dealing with individual chars is what you want?
Are you sure pos doesn't cut a char in half?
The indexing checks that
Well yeah, but it panics if you are wrong
So does the unwrap if pos points at the end of the string
And you want to work with chars not graphemes?