From: Brian Candler Date: 2008-09-18T22:09:18+09:00 Subject: Re: Suggestion for string parsing > thanks, > but what I would like to avoid regexp, it seems strange to me that > there's no way to parse a string providing the structure. > scanf would be great but if I put %s it doesn't get the string, unless I > put the number of chars. %s is terminated by whitespace. You have no way of telling scanf that you want to treat "=" (after the first field) and "," (after the second field) as separators, rather than characters to be consumed by %s. Well, as long as your data doesn't contain spaces, you could do line="Client=MPEG-4,390000,700000,24000" line.gsub(/[=,]/,' ').scanf("%s %s %d %d %d") -- Posted via http://www.ruby-forum.com/.