Call to all you one-liners !
Peter Brigham MD
pmbrig at gmail.com
Sat Jun 26 08:55:22 EDT 2010
On Jun 26, 2010, at 6:21 AM, Scott Rossi wrote:
> Recently, Mark Schonewille wrote:
>
>> put (fld 1 is a color and the number of items of fld 1 is 3) into
>> myIsRGB
>
> "...is a color..." Gad, I never knew about this usage. Good to know.
>
> Thanks & Regards,
>
> Scott Rossi
I didn't know that either. I experimented a little with this.
put "255,255" is a color --> false, but
put "255,255,255,34" is a color --> true,
hence the need for the extra check for the number of items = 3.
But beware:
put "255,255,401" is a color --> true
so the range is not checked, instead 401 is "wrapped" (mod 256) to 146
when the color is set to such a triplet
For a really strict parsing in just one line, I suspect you have to
use Regex. Notice I said "you," since *I* can't use Regex to save my
life, though I'm happy to copy and paste snippets provided by others
into my scripts when needed....
-- Peter
Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig
More information about the use-livecode
mailing list