Phone Number Parsing
Mix.install([
{:kino, github: "livebook-dev/kino", override: true},
{:kino_lab, "~> 0.1.0-dev", github: "jonatanklosko/kino_lab"},
{:vega_lite, "~> 0.1.4"},
{:kino_vega_lite, "~> 0.1.1"},
{:benchee, "~> 0.1"},
{:ecto, "~> 3.7"},
{:math, "~> 0.7.0"},
{:faker, "~> 0.17.0"},
{:utils, path: "#{__DIR__}/../utils"},
{:tested_cell, git: "https://github.com/BrooklinJazz/tested_cell"}
])
Navigation
Phone Number Parsing
You have been provided a large string of phone numbers. The problem is, each phone number does not follow a standard format.
You have been asked to convert them from the non standardized format into a standard format.
Phone numbers will be given in the following formats:
-
1231231234
-
123 123 1234
-
(123)-123-1234
-
(123) 123 1234
-
(123)123-1234
You need to convert them into the format 123-123-1234
.
text = "
1231231234
123 123 1234
(123)-123-1234
(123) 123 1234
(123)123-1234
"
PhoneNumber.parse(text)
"
123-123-1234
123-123-1234
123-123-1234
123-123-1234
123-123-1234
"
Enter your answer below.
defmodule PhoneNumber do
def parse(string) do
end
end
Utils.feedback(:phone_number_parsing, PhoneNumber)
Commit Your Progress
Run the following in your command line from the project folder to track and save your progress in a Git commit.
$ git add .
$ git commit -m "finish phone number parsing exercise"