Skip to content

Commit

Permalink
Merge c6b1895 into 9c80ec8
Browse files Browse the repository at this point in the history
  • Loading branch information
Betree committed Dec 19, 2018
2 parents 9c80ec8 + c6b1895 commit 8f453da
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions apps/db/lib/db_utils/string.ex
Expand Up @@ -13,6 +13,12 @@ defmodule DB.Utils.String do
iex> DB.Utils.String.trim_all_whitespaces ""
""
"""
def trim_all_whitespaces(str),
do: String.replace(String.trim(str), ~r/\s+/, " ")
def trim_all_whitespaces(nil),
do: nil

def trim_all_whitespaces(str) do
str
|> String.trim()
|> String.replace(~r/\s+/, " ")
end
end

0 comments on commit 8f453da

Please sign in to comment.