finish lesson 01

This commit is contained in:
Chang CL
2025-08-26 23:15:16 +08:00
parent d9ed6dec0f
commit 01c487374d

View File

@@ -17,30 +17,30 @@ defmodule Strings do
end end
koan "Or pulled apart into a list when needed" do koan "Or pulled apart into a list when needed" do
assert ["hello", "world"] == String.split(___, " ") assert ["hello", "world"] == String.split("hello world", " ")
end end
koan "Be careful, a message may be altered" do koan "Be careful, a message may be altered" do
assert String.replace("An awful day", "awful", "incredible") == ___ assert String.replace("An awful day", "awful", "incredible") == "An incredible day"
end end
koan "But strings never lie about themselves" do koan "But strings never lie about themselves" do
assert true == String.contains?("An incredible day", ___) assert true == String.contains?("An incredible day", "day")
end end
koan "Sometimes you want just the opposite of what is given" do koan "Sometimes you want just the opposite of what is given" do
assert ___ == String.reverse("ananab") assert "banana" == String.reverse("ananab")
end end
koan "Other times a little cleaning is in order" do koan "Other times a little cleaning is in order" do
assert String.trim(" \n banana\n ") == ___ assert String.trim(" \n banana\n ") == "banana"
end end
koan "Repetition is the mother of learning" do koan "Repetition is the mother of learning" do
assert String.duplicate("String", 3) == ___ assert String.duplicate("String", 3) == "StringStringString"
end end
koan "Strings can be louder when necessary" do koan "Strings can be louder when necessary" do
assert String.upcase("listen") == ___ assert String.upcase("listen") == "LISTEN"
end end
end end