We're a place where coders share, stay up-to-date and grow their careers.
Elixir:
defmodule Phone do def hide(string = <<plain::binary-size(5), hidden::binary>>) do String.match?(string, ~r/\d{3}-\d{3}-\d{4}/) && plain <> String.replace(hidden, ~r/\d/, "X") end end
Uses some bitstring pattern matching :)
Elixir:
Uses some bitstring pattern matching :)