One thing to keep in mind with that version: Lines that have data, but no whitespace - lines with just a single word - will get a tab stuck on the end, which may or may not be what you want in that case. If you don't want a tab just before the return in such lines, you can add this after the repeat:
if space is not in tLine then put tLine & return after tResultTable else put word 1 of... And if this is a one-shot utility function, than any of these solutions that work for you are great. But if you will be doing this as a feature of a program, and the amounts of data you'll be pushing through are large, then modifying the data in-place saves time and memory over copying large quantities of text between two variables. Just sayin'. :) ~ Chris Innanen ~ Nonsanity On Wed, May 25, 2011 at 11:14 AM, Keith Clarke < keith.cla...@clarkeandclarke.co.uk> wrote: > Thanks to Roger, Ken and Chris for playing - but Jim gets the prize for the > simplicity brought through passing data out to a second variable, line by > line, rather than trying to fix the data in place (which is an interesting > mental challenge but quite convoluted). > > So, I settled on this four line fix variant on Jim's first solution (I > found that had to declare the line explicitly for each word chunk) > > repeat for each line tLine in tSourceList > put word 1 of tLine & tab & word 2 to -1 of tLine & return after > tResultTable > end repeat > filter tResultTable without empty > > So, I now have a nice, clean label-value table field. > > Nice that variables are 10 a penny in LiveCode! :-) > Best, > Keith.. > _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode