From: 7stud -- Date: 2007-10-28T12:21:48+09:00 Subject: Re: convert string format Brian Adkins wrote: > > Yeah, but scanf is implemented in Ruby, so it's 25 times slower (at > least by a crude, quick benchmark) than unpack or insert :( > This one is super speedy: str = '20070801' new_str = sprintf("%4s/%2s/%2s", str, str, str) On my system sprintf() is twice as fast as unpack(), which is twice as fast as match(). -- Posted via http://www.ruby-forum.com/.