diff options
Diffstat (limited to 'lib/chessh/utils.ex')
-rw-r--r-- | lib/chessh/utils.ex | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/chessh/utils.ex b/lib/chessh/utils.ex index 1a7f8cf..3e83d5e 100644 --- a/lib/chessh/utils.ex +++ b/lib/chessh/utils.ex @@ -6,4 +6,9 @@ defmodule Chessh.Utils do |> List.delete_at(-1) |> to_string() end + + def text_dim(text) do + split = String.split(text, "\n") + {Enum.reduce(split, 0, fn x, acc -> max(acc, String.length(x)) end), length(split)} + end end |