Showing posts with label regular expression. Show all posts
Showing posts with label regular expression. Show all posts

Friday, November 13, 2009

How to remove extra spaces in ruby strings

by sandipransing 0 comments
In ruby, one can write multiple codes to remove multiple blank spaces inside strings (sentenses)
 
"Write      your       string            here   ".squeeze.strip
"This     is my      input  string     ".gsub(/ +/, ' ')
"Write      your       string          here   ".split('  ').join(' ')
Read More…

About The Author

Sandip is a ruby on rails developer based in pune and also a blogger at funonrails. Opensource contributor and working with Josh software Private Limited. for more info read Follow Sandip on Twitter for updates.

Connect With Me...

Github Projects

@sandipransing Twitter