How to replace just the first found space with tab for all lines in a variable?
Ken Ray
kray at sonsothunder.com
Wed May 25 10:15:21 EDT 2011
Another possible approach is:
put fld 1 into tTemp
put empty into tResult
repeat for each line tLine in tTemp
delete char offset(space,tLine) of tLine
put tLine & cr after tResult
end repeat
delete char -1 of tResult
>> tResult has your data
Ken Ray
Sons of Thunder Software, Inc.
On May 25, 2011, at 6:20 AM, Jim Ault <jimaultwins at yahoo.com> wrote:
> 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
>
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list