[OT] reOrdering text

Richmond richmondmathewson at gmail.com
Wed Jan 16 14:18:40 EST 2013


On 01/16/2013 05:19 PM, Mike Bonner wrote:
> Assuming the data is always in the same order something like the following
> works well.
>
> *on* mouseUp
>
>     *put* field 1 into tData
>
>     *put* 1 into tCount
>
>     *repeat* for each line tLine in tData
>
>        *switch* tcount
>
>           *case* 1
>
>              *put* tLine & cr into tTmp
>
>              *put* 2 into tCount
>
>              *break*
>
>           *case* 2
>
>              *put* tline & cr before tTmp
>
>              *put* 3 into tCount
>
>              *break*
>
>           *default*
>
>              *put* tTmp & tLine & cr after tNewData
>
>              *put* 1 into tCount
>
>        *end* *switch*
>
>     *end* *repeat*
>
>     *delete* the last char of tNewData
>
>     *put* tNewData -- finished data
>
> *end* mouseUp
>
>
> Otherwise, if the order isn't perfect for all triads, you'd have to read
> each line until you get both a fishface and a finish and then put things in
> order.
>
>
> On Wed, Jan 16, 2013 at 8:06 AM, Richmond <richmondmathewson at gmail.com>wrote:
>
>> I have a socking great text file that reads in part something like this:
>>
>> Cook my cheese
>> fishface1
>> finish
>> Shave my legs
>> fishface2
>> finish
>> Paint my fingernails
>> fishface3
>> finish
>> Wax my arms
>> fishface4
>> finish
>>
>> and so it goes for about 72 pages (!!!)
>>
>> Now what I needs is a reordered lilst like this:
>>
>> fishface1
>> Cook my cheese
>> finish
>> fishface2
>> Shave my legs
>> finish
>> fishface3
>> Paint my fingernails
>> finish
>> fishface4
>> Wax my arms
>> finish
>>
>> and, as a fairly lazy slob, I have no great wish to effect that manually.
>>
>> But, for the life of me I cannot work out how to do that automatically,
>> either inwith or outwith Livecode.
>>
>> Richmond.
>>
>> ______________________________**_________________
>> 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<http://lists.runrev.com/mailman/listinfo/use-livecode>
>>
> _______________________________________________
> 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

I'm sorry to say that seems to put things in the wrong order.




More information about the use-livecode mailing list