Avoid comparing findfirst to nothing (#3200)

This commit is contained in:
Rik Huijzer 2020-12-23 23:35:11 +01:00 committed by GitHub
parent 8f0d4c4145
commit 0f349be952
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -219,7 +219,7 @@ gr_inqtext(x, y, s) = gr_inqtext(x, y, string(s))
function gr_inqtext(x, y, s::AbstractString)
if length(s) >= 2 && s[1] == '$' && s[end] == '$'
GR.inqmathtex(x, y, s[2:end-1])
elseif findfirst(isequal('\\'), s) !== nothing || occursin("10^{", s)
elseif occursin('\\', s) || occursin("10^{", s)
GR.inqtextext(x, y, s)
else
GR.inqtext(x, y, s)
@ -231,7 +231,7 @@ gr_text(x, y, s) = gr_text(x, y, string(s))
function gr_text(x, y, s::AbstractString)
if length(s) >= 2 && s[1] == '$' && s[end] == '$'
GR.mathtex(x, y, s[2:end-1])
elseif findfirst(isequal('\\'), s) !== nothing || occursin("10^{", s)
elseif occursin('\\', s) || occursin("10^{", s)
GR.textext(x, y, s)
else
GR.text(x, y, s)