문제

Why does this work:

iex(9)> Enum.filter(["lowks", "kian", "seong"], fn(x) -> x == "lowks" end)
["lowks"]

While this does not:

iex(5)> Enum.filter(String.split("low kian seong"), fn(x) -> x == "lowks" end) []

Is it because I am filtering the function ?

도움이 되었습니까?

해결책

Unless I'm missing something, you have a typo in the second example. It should be lowks not low.

iex(1)> Enum.filter(String.split("lowks kian seong"), fn(x) -> x == "lowks" end)
["lowks"]
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top