In cases where the number of characters plus the starting position is greater than ncodeunits(str)+1
, nextind
should really return (as documented) ncodeunits(str)+1
.
Also, if nchar
is 0, nextind
and prevind
should act the same as thisind
, IMO.
prevind
, if nchar
is greater than the number of characters before the given position,
should really return a 0, instead of some negative number.
julia> prevind("foobar", 7, 10000)
-9993
julia> nextind("foobar", 1, 10000)
10001
julia> prevind("foobar", 1)
0
julia> nextind("foobar", 6)
7
(I discovered this after implementing these new functions for my Strs.jl
package, and then comparing the results to nextind
and prevind
on String
).