Skip to content

Commit ae8def3

Browse files
committed
:binary.match supports a list of matches
1 parent f0ecfbf commit ae8def3

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/elixir/lib/string.ex

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -860,11 +860,9 @@ defmodule String do
860860
861861
"""
862862
def contains?(string, matches) when is_list(matches) do
863-
Enum.any? matches, fn match ->
864-
case :binary.matches(string, match) do
865-
[_] -> true
866-
[] -> false
867-
end
863+
case :binary.match(string, matches) do
864+
:nomatch -> false
865+
_ -> true
868866
end
869867
end
870868

0 commit comments

Comments
 (0)