Avoid comparing findfirst to nothing

This commit is contained in:
Rik Huijzer 2020-12-23 20:20:27 +01:00
parent 8f0d4c4145
commit 7224588438

View File

@ -219,7 +219,7 @@ gr_inqtext(x, y, s) = gr_inqtext(x, y, string(s))
function gr_inqtext(x, y, s::AbstractString) function gr_inqtext(x, y, s::AbstractString)
if length(s) >= 2 && s[1] == '$' && s[end] == '$' if length(s) >= 2 && s[1] == '$' && s[end] == '$'
GR.inqmathtex(x, y, s[2:end-1]) 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) GR.inqtextext(x, y, s)
else else
GR.inqtext(x, y, s) 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) function gr_text(x, y, s::AbstractString)
if length(s) >= 2 && s[1] == '$' && s[end] == '$' if length(s) >= 2 && s[1] == '$' && s[end] == '$'
GR.mathtex(x, y, s[2:end-1]) 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) GR.textext(x, y, s)
else else
GR.text(x, y, s) GR.text(x, y, s)