Using String.strip, String.lstrip, and String.rstrip to trim whitespace from strings:

iex> String.strip("   abc  ")
"abc"