more normalization and copy button
This commit is contained in:
@ -13,11 +13,12 @@ defmodule Clip.Board do
|
||||
end
|
||||
|
||||
def normalize(pnumber, local_pref \\ "0351", country_pref \\ "0049") do
|
||||
pnumber
|
||||
outp = pnumber
|
||||
|> String.replace(~r/^\s*\+/, "00")
|
||||
|> String.replace(~r/\D/, "")
|
||||
|> String.replace(~r/^00+/, "00")
|
||||
|> String.replace(~r/^(?=[1-9])/, local_pref)
|
||||
|> String.replace(~r/^0(?=[1-9])/, country_pref)
|
||||
"0#{outp}#"
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user