7stud -- wrote: > Brian Adkins wrote: >> On Oct 27, 11:21 pm, 7stud -- <bbxx789_0... / yahoo.com> wrote: >>> 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. :) > > No wonder it was so much faster than this one: > > str = '20070801' > new_str = sprintf("%s/%s/%s", str[0..3], str[4..5], str[6..7]) > > > :( > :( > :( Well, use sprintf("%s/%s/%s", str[0,4], str[4,2], str[6,2]) then, it's still a lot faster than the other solutions. Regards Stefan -- Posted via http://www.ruby-forum.com/.