diff options
| -rwxr-xr-x | challenge-328/packy-anderson/elixir/ch-1.exs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/challenge-328/packy-anderson/elixir/ch-1.exs b/challenge-328/packy-anderson/elixir/ch-1.exs index e396a61f9f..67d0bfd191 100755 --- a/challenge-328/packy-anderson/elixir/ch-1.exs +++ b/challenge-328/packy-anderson/elixir/ch-1.exs @@ -1,7 +1,7 @@ #!/usr/bin/env elixir defmodule PWC do - def replaceAllQuestion(str) do + def replace_all_question(str) do match = Regex.named_captures( ~r/(?<before>.)\?+(?<after>.)/, str @@ -13,7 +13,7 @@ defmodule PWC do replace = ?a..?z |> Enum.take_random(1) |> List.to_string str = Regex.replace(~r/\?/, str, replace, global: false) # recursively call this function to replace any remaining ?s - replaceAllQuestion(str) + replace_all_question(str) else # return the unmodified string if there are no ? characters str @@ -22,7 +22,7 @@ defmodule PWC do def solution(str) do IO.puts("Input: $str = \"#{str}\"") - IO.puts("Output: \"#{replaceAllQuestion(str)}\"") + IO.puts("Output: \"#{replace_all_question(str)}\"") end end |
