Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com)
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi
Tinderbox Users >> Agent, Actions, Rules & Automation >> .contains() vs .icontains()
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1470338241

Message started by Sumner Gerard on Aug 4th, 2016, 3:17pm

Title: .contains() vs .icontains()
Post by Sumner Gerard on Aug 4th, 2016, 3:17pm

I am having trouble understanding when to use .contains() and when to use .icontains() in an agent query when looking for matches in a string (in my case $Text or $Name).

Part of my confusion stems from the existence of the 'Case insensitive' checkmark in inspector, which I just assumed could apply to a query where I was using .contains().

I understand (from message off-forum) that .contains() is always case sensitive and that icontains() should be used for case insensitive.

Is that the only difference between the two?

Title: Re: .contains() vs .icontains()
Post by Mark Anderson on Aug 4th, 2016, 3:50pm

Now that we have .contains() and .icontains() , the case-sensitive boxes they're effectively there for legacy reasons only (and for folks who just won't change their style). I'd leave them in the default position and never touch them again. What's the default? Open a new doc and look at the relevant bit of the UI. For old docs, I'd reset those controls and update actions to use the new dot operators. So...

.contains() does a case-sensitive test. So $MyString.contains("Dog") will match 'Dog' but not 'dog' or 'DOG', etc.  Every character in the tested string and match must be the same case.

.icontains() does a case-insensitive test. So $MyString.icontains("Dog") will match 'Dog' and 'dog', 'DOG', etc. Indeed it will match the sequences of letters d, o and g in any case combination.

It's that's simple.

TB's around 15 years old and under gradual improvement all that time, so some stuff has stuck around. I'd put the case-sensitivity boxes in that group. Still, if removed it would cause a few long term users problems and I'm sure the developer doesn't relish the sort of support calls that sort of situation would generate.  :o

Title: Re: .contains() vs .icontains()
Post by Sumner Gerard on Aug 4th, 2016, 4:05pm

Thanks, Mark.  So the "i" stands for (case) "insensitive" ... and leave those legacy boxes (and presumably the AgentCaseSensitive attribute) alone!  

Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com) » Powered by YaBB 2.2.1!
YaBB © 2000-2008. All Rights Reserved.