Sorting lines on colour (color for some)

Thierry Douez th.douez at gmail.com
Thu Sep 18 14:01:26 EDT 2014


Another one with some regex flavor


on mouseUp
   local t
   put the htmltext of fld 1 into t
   sort lines of t  by getHtmlColors( each)
   set  the htmltext of fld 1 to t
end mouseUp

function getHtmlColors L
   if matchText( L, "<p bgcolor=.#([0-9A-F]{6}).>", v) then  return v
   return "z"
end getHtmlColors

Thierry

------------------------------------------------
Thierry Douez - http://sunny-tdz.com
Maker of sunnYperl - sunnYmidi - sunnYmage


2014-09-18 18:46 GMT+02:00 Francis Nugent Dixon <effendi at wanadoo.fr>:
> Hi from Beautiful Brittany (where, finally, it is raining),
>
> I have a list in a field, with backgroundcolor of some lines red, some yellow.
> Does anybody know how to sort the lines to separate out the two colours ?
>
> I can do it using a shuffle mechanism, but it’s not elegant enough (:>) !!
>
> The sort container command doesn’t give me the impression that this is a
> one-liner …….
>
> He who uses the least lines of code will gain my immediate admiration ……
>
> —Francis
> _______________________________________________
> 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