From: Lloyd Linklater Date: 2008-09-18T22:13:05+09:00 Subject: Re: Suggestion for string parsing Me Me wrote: > Brian Candler wrote: >>> is there a way to use the scanf to parse a string not knowing how many >>> chars? >> >> I'd still use Regexp. >> > > 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. Well, you can always write a BreakApart() algorithm but I must agree with Brian that RegEx is the way to go. After all, that is what RegEx does. I was tempted to add BreakApart() code here but I am neither sure that it is what you really want nor that it is the best solution for the problem at hand. What is the *actual* problem? If it is what you said ("I would like to know if there's a better way to parse a string and assing values to variables;") then RegEx is a fine solution. If you reject a good solution and seek something else, then it can only be that you are actually seeking a solution to a different problem. So, what are you *really* looking for? -- Posted via http://www.ruby-forum.com/.