My empirical experiment shows that if I setSpan(o, start, end) from start to end of a string, where end is String.length() - 1, the last character isn't covered.
When I changed end to exactly String.length(), the entire string is covered and... I don't even get an "out-of-bound" exception.
Unfortunately, there is nothing in the documentation regarding this particular issue.
Can you confirm my observation? (or prove me wrong?)
end is exclusive. 0, 2, for example, is everything from 0 inclusive to 2 exclusive which is 0 and 1.
Most "ending" indexes will be exclusive as a matter of practice. That is, the ending index is one beyond the index of the last whatever-it-is. If SpannableString is the one from the Android SDK, then no, the documentation doesn't say this for method setSpan, though it does for other methods such as subSequence.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With