We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6dca4f4 commit 3f2eed3Copy full SHA for 3f2eed3
base/strings/basic.jl
@@ -196,12 +196,7 @@ getindex(s::AbstractString, v::AbstractVector{Bool}) =
196
throw(ArgumentError("logical indexing not supported for strings"))
197
198
function get(s::AbstractString, i::Integer, default)
199
-# TODO: use ternary once @inbounds is expression-like
200
- if checkbounds(Bool, s, i)
201
- @inbounds return s[i]
202
- else
203
- return default
204
- end
+ checkbounds(Bool, s, i) ? (@inbounds s[i]) : default
205
end
206
207
## bounds checking ##
0 commit comments