Created
June 24, 2014 10:22
-
-
Save tisba/e3a410c294e6f06f604e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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