Skip to content

Commit

Permalink
Replace search(s, t) with something(findfirst(t, s), 0:-1) (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
DilumAluthge authored and musm committed Jan 24, 2020
1 parent 8e590a1 commit b6f4bb9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "LibExpat"
uuid = "522f3ed2-3f36-55e3-b6df-e94fee9b0c07"
version = "0.6.0"
version = "0.6.1"

[deps]
Expat_jll = "2e619515-83b5-522b-bb60-26c02a35a201"
Expand Down
2 changes: 1 addition & 1 deletion gen/generate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ wc = wrap_c.init(
clang_extraargs,
(th, h) ->
begin
if search(h, "expat") == 0:-1
if something(findfirst("expat", h), 0:-1) == 0:-1
return false
else
# println("th : $th, h : $h")
Expand Down
6 changes: 3 additions & 3 deletions src/xpath.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ function xpath_expr(pd, xp::XPath{T}, filter::Tuple{Symbol,Any}, position::Int,
elseif op == :contains
a = xpath_string(xpath_expr(pd, xp, args[1]::SymbolAny, position, last, Any))::AbstractString
b = xpath_string(xpath_expr(pd, xp, args[2]::SymbolAny, position, last, Any))::AbstractString
return !(isempty(search(a, b)))::Bool
return !(isempty(something(findfirst(b, a), 0:-1)))::Bool
elseif op == :startswith
a = xpath_string(xpath_expr(pd, xp, args[1]::SymbolAny, position, last, Any))::AbstractString
b = xpath_string(xpath_expr(pd, xp, args[2]::SymbolAny, position, last, Any))::AbstractString
Expand All @@ -1050,7 +1050,7 @@ function xpath_expr(pd, xp::XPath{T}, filter::Tuple{Symbol,Any}, position::Int,
elseif op == :substring_before
a = xpath_string(xpath_expr(pd, xp, args[1]::SymbolAny, position, last, Any))::AbstractString
b = xpath_string(xpath_expr(pd, xp, args[2]::SymbolAny, position, last, Any))::AbstractString
i = first(search(a,b))
i = first(something(findfirst(b, a), 0:-1))
if i < 1
return ""
else
Expand All @@ -1059,7 +1059,7 @@ function xpath_expr(pd, xp::XPath{T}, filter::Tuple{Symbol,Any}, position::Int,
elseif op == :substring_after
a = xpath_string(xpath_expr(pd, xp, args[1]::SymbolAny, position, last, Any))::AbstractString
b = xpath_string(xpath_expr(pd, xp, args[2]::SymbolAny, position, last, Any))::AbstractString
i = last(search(a,b))
i = last(something(findfirst(b, a), 0:-1))
if i < 1
return ""
else
Expand Down

0 comments on commit b6f4bb9

Please sign in to comment.