From: Brian Adkins Date: 2007-10-28T14:55:09+09:00 Subject: Re: convert string format On Oct 27, 11:21 pm, 7stud -- wrote: > 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(). Yes, but fast and incorrect is a bad combination. :)