Skip to content

Commit

Permalink
Add get(string, index, default)
Browse files Browse the repository at this point in the history
  • Loading branch information
staticfloat committed Jun 23, 2017
1 parent 0737032 commit 66a7df7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions base/strings/basic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ getindex(s::AbstractString, v::AbstractVector{<:Integer}) =
getindex(s::AbstractString, v::AbstractVector{Bool}) =
throw(ArgumentError("logical indexing not supported for strings"))

get(s::AbstractString, i::Integer, default) = start(s) <= i <= endof(s) ? s[i] : default
Symbol(s::AbstractString) = Symbol(String(s))

"""
Expand Down

0 comments on commit 66a7df7

Please sign in to comment.