Filter
dunbarx at aol.com
dunbarx at aol.com
Fri Dec 9 15:11:18 EST 2011
Ah. Thanks, everyone.
I knew about the lines, the string I tested with, was, after all, a line.
But I did not get from the dictionary the power of the wildcard char "*". The example there was "A*C", and I saw that one or more chars could be between those outer chars. I did not appreciate the "*A*" syntax.
Craig Newman
-----Original Message-----
From: Bob Sneidar <bobs at twft.com>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Fri, Dec 9, 2011 9:33 am
Subject: Re: Filter
BTW you will get the contents of the entire line by using filter temp with
"*c*". As I mentioned it works with entire lines, not chunks of text.
If you are trying to see if "abcdef" contains "c" use "c" is in "abcdef". If you
are trying to find which character contains the first "c" use offset("c",
"abcdef"). If you are trying to find ALL the "c"'s in the string it gets
trickier. If the string HAS to be formatted that way, then you will need a
repeat loop.
put 0 into theCount
put "abcdef" into theString
repeat for each char theChar in theString
add one to theCount
if theChar is "c" then
put theCount & comma after thePositionList
end if
end repeat
delete the last char of thePositionList
optionally you could do this:
put "abcdef" into theString
repeat for each char theChar in theString
put theChar & cr after theNewString
end repeat
filter theNewString with "c"
I can't think of how that would be useful, but I don't know what you are doing.
Bob
On Dec 9, 2011, at 11:15 AM, dunbarx at aol.com wrote:
>
>
> What am I doing wrong? If I have:
> on mouseup
> put "abcdef" into temp
> filter temp with "c"
> put temp
> end mouseup
> I get empty. I don't need more empty.
> Craig Newman
>
> _______________________________________________
> 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
_______________________________________________
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