From b8bb9638d3521d2173966203b2c5893597b1a27b Mon Sep 17 00:00:00 2001 From: "exercism-solutions-syncer[bot]" <211797793+exercism-solutions-syncer[bot]@users.noreply.github.com> Date: Thu, 15 Jan 2026 16:23:50 +0000 Subject: [PATCH] [Sync Iteration] elixir/high-school-sweetheart/2 --- .../2/lib/high_school_sweetheart.ex | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 solutions/elixir/high-school-sweetheart/2/lib/high_school_sweetheart.ex diff --git a/solutions/elixir/high-school-sweetheart/2/lib/high_school_sweetheart.ex b/solutions/elixir/high-school-sweetheart/2/lib/high_school_sweetheart.ex new file mode 100644 index 0000000..c439bcc --- /dev/null +++ b/solutions/elixir/high-school-sweetheart/2/lib/high_school_sweetheart.ex @@ -0,0 +1,30 @@ +defmodule HighSchoolSweetheart do + def first_letter(name) do + name + |> String.trim + |> String.codepoints + |> List.first + end + + def initial(name) do + name + |> first_letter + |> String.upcase + |> Kernel.<>(".") + end + + def initials(full_name) do + full_name + |> String.split + |> Enum.map(&initial/1) + |> Enum.join(" ") + end + + def pair(full_name1, full_name2) do + """ + ❤-------------------❤ + | #{initials(full_name1)} + #{initials(full_name2)} | + ❤-------------------❤ + """ + end +end