Page 1 of 1

Competition #1C: Reverse order of lines of a string

Posted: Tue Dec 10, 2013 12:13 am
by [-hh]
..........

Re: Competition #1C: Reverse order of lines of a string

Posted: Tue Dec 10, 2013 3:44 pm
by [-hh]
..........

Re: Competition #1C: Reverse order of lines of a string

Posted: Sun Jan 12, 2014 12:26 pm
by bn
Hi Hermann,

in another post the reverse order of lines came up and I remembered a discussion on the use-list using sort with function brought forth by Jacque. See sort in dictionary.

obviously you would have to have 2 fields, 1 "source" and 1 "destination" to run this script

Code: Select all

local sNoLines -- index used by function inverseLines to sort

on mouseUp
   put field "source" into tData
   put 0 into sNoLines -- dont worry it will count down below 0
   sort lines of tData numeric by inverseLines()
   put tData into field "destination"
end mouseUp

 private function inverseLines
   subtract 1 from sNoLines
   return sNoLines
end inverseLines
Kind regards
Bernd