From: "Peña, Botp" Date: 2008-09-18T18:44:02+09:00 Subject: Re: Suggestion for string parsing From: Me Me [mailto:emanuelef@tiscali.it] # I was thinking if there some kind of c sscanf, # so that I could parse and assing to variable at the same time # so if I have # line="Client=MPEG-4,390000,700000,24000" # something like: # sscanf(line, %s=%s %s %d %d %d, val1, val2, val3, val4, val5, val6) # I don't know if there's a similar string function for this in Ruby you are right on scanf. there is one in ruby, and it's a lot simpler than you think you'll have to require it though before using, eg, > require 'scanf' => false > line.scanf("%6s=%6s,%d,%d,%d,%d") => ["Client", "MPEG-4", 390000, 700000, 24000]