I recently I ran into a problem in Erlang project and I had to find a way to Remove multiple spaces in string and leave only one one space.
Some string with extra spaces.
Solution:
Here is solution how to remove it with simple re:replace
re:replace("Some string with extra spaces.", "(\\s+\\s+)", " ", [global,{return,list}]).
and the returned output is:
Some string with extra spaces.
Useful links:
http://stackoverflow.com/questions/12794358/how-to-strip-all-blank-characters-in-a-string-in-erlang
