mirror of
https://github.com/rjNemo/exercism-elixir
synced 2026-06-06 02:16:48 +00:00
29 lines
806 B
Elixir
29 lines
806 B
Elixir
defmodule HighSchoolSweetheart do
|
|
def first_letter(name), do: name |> String.trim() |> String.first()
|
|
|
|
def initial(name), do: "#{name |> first_letter |> String.upcase()}."
|
|
|
|
def initials(full_name) do
|
|
[first, last] = full_name |> String.split()
|
|
"#{initial(first)} #{initial(last)}"
|
|
end
|
|
|
|
def pair(full_name1, full_name2) do
|
|
"""
|
|
****** ******
|
|
** ** ** **
|
|
** ** ** **
|
|
** * **
|
|
** **
|
|
** #{initials(full_name1)} + #{initials(full_name2)} **
|
|
** **
|
|
** **
|
|
** **
|
|
** **
|
|
** **
|
|
** **
|
|
***
|
|
*
|
|
"""
|
|
end
|
|
end
|