On Sat, May 23, 2009 at 12:49 PM, Santosh Turamari
<[email protected]> wrote:
> Thanks for the reply.. Here my main problem is I want to have only
> space between two words. Here if I use only company.downcase.strip, then
> it is taking '+'sign such as "abc+xyz".. I want it to be"abc xyz". Can I
> get the condition to produce the output of that kind.!
Look at your gsub; if you want a space instead of '-', it should be
pretty obvious what to do :-)
Open up irb and play with it a bit until you get the result you want:
irb(main):001:0> ("abc
xyz".gsub(/[^[:alnum:]'&''.''!']/,'-')).squeeze("-").chomp("-")
=> "abc-xyz"
--
Hassan Schroeder ------------------------ [email protected]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---