Skip to content

Instantly share code, notes, and snippets.

@tisba
Created June 24, 2014 10:22
Show Gist options
  • Save tisba/e3a410c294e6f06f604e to your computer and use it in GitHub Desktop.
Save tisba/e3a410c294e6f06f604e to your computer and use it in GitHub Desktop.
def remove_sequential_spaces(value) do
# TODO how can this be expressed via pattern matching?
if String.starts_with?(value, "\"") || String.ends_with?(value, "\"") do
value
else
String.replace(value, ~r/\ {2,}/, " ")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment