Skip to content

Commit

Permalink
correct reverseind example for Unicode (#40156)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevengj authored Apr 3, 2021
1 parent c90e8e1 commit 595b0e6
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions base/strings/basic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -676,13 +676,16 @@ cases where `v` contains non-ASCII characters.)
# Examples
```jldoctest
julia> r = reverse("Julia")
"ailuJ"
julia> s = "Julia🚀"
"Julia🚀"
julia> for i in 1:length(r)
print(r[reverseind("Julia", i)])
julia> r = reverse(s)
"🚀ailuJ"
julia> for i in eachindex(s)
print(r[reverseind(r, i)])
end
Julia
Julia🚀
```
"""
reverseind(s::AbstractString, i::Integer) = thisind(s, ncodeunits(s)-i+1)
Expand Down

0 comments on commit 595b0e6

Please sign in to comment.