From: ara.t.howard@... Date: 2006-08-20T01:02:49+09:00 Subject: Re: Convert "ThisIsSomeString" to "this_is_some_string"? On Sun, 20 Aug 2006, [UTF-8] Marcin Miel��y�~Dski wrote: > Joshua Muheim wrote: >> Hi all >> >> What's the fastest way to convert "ThisIsSomeString" to >> "this_is_some_string"? >> >> Thanks for help, >> Joshua >> > > p "ThisIsSomeString".scan(/[A-Z][a-z]+/).map{|w|w.downcase}.join('_') > p "this_is_some_string".split('_').map{|w|w.capitalize}.join > irb(main):001:0> "FooBAR".scan(/[A-Z][a-z]+/).map{|w|w.downcase}.join('_') => "foo" it's trickier than it looks. -a -- to foster inner awareness, introspection, and reasoning is more efficient than meditation and prayer. - h.h. the 14th dali lama