like

From Second Life Wiki
Revision as of 17:28, 14 July 2008 by Strife Onizuka (talk | contribs) (style rewrite and optimizations)
Jump to navigation Jump to search

Summary

Function: integer like( string value, string mask );

See if one word matches part of another.
Returns an integer that is TRUE if value tested positive for mask, otherwise it is FALSE.

• string value
• string mask

You can, for example, loop through a list, passing it extracted values from the list and the mask, and it will let you pull out items from the list which are a valid match according to the mask criteria you specified.

Specification

<lsl>integer like(string value, string mask) {

   integer tmpy = (llGetSubString(mask,  0,  0) == "%")

Examples

<lsl>like("Susie", "Sus%"); //will return true, for any value starting with "Sus" like("Susie", "%Sus%"); //will return true, for any value containing "Sus" like("Susie", "%Sus"); //will return false. This example is looking for a string ending in "Sus".

like("Susie", "Sus"); //will return false. This example is looking for a string matching only "Sus" exactly.</lsl>

Deep Notes

Source

Posted here with the kind permission of Very Keynes. Originally posted February 2008 at http://forums.secondlife.com/showthread.php?t=243445 .

Signature