How to replace just the first found space with tab for all lines in a variable?

Jim Ault jimaultwins at yahoo.com
Wed May 25 07:20:17 EDT 2011


Debugging hint when working with 'tab'
Save time and agro by...

using "M" so that it is easy to see the replacements and extras.
so try this

put tab into T
put "M" into T --for debugging

put fld 1 into tempp
repeat for each line LNN in tempp
       put word 1 to -1 of LNN into cleanLine  --trim
       put word 1 of cleanLine & T & word 2 to -1 of cleanLine & cr  
after newList
    end repeat
    ;put newList
    --filter newList without T  --in case there should be empty lines
    put 0 into prevNum
    repeat until the number of chars in newList is prevNum
       put the number of chars in newList into prevNum
       replace (cr & T & cr) with ( cr & cr) in newList
    end repeat
    ;put newList
    filter newList without empty
    ;put newList


Jim Ault
Las Vegas






More information about the use-livecode mailing list