Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Substring search pattern

Buck Clutterbuck
Registered User
Join date: 10 Mar 2006
Posts: 1
03-29-2006 16:45
Heres a silly question but the wiki doesnt define what "patterns" are allowed if any.

integer llSubStringIndex(string source, string pattern)
http://secondlife.com/badgeo/wakka.php?wakka=llSubStringIndex

Can the "pattern" include wildcards?

i.e.
llSubStringIndex(source, "Joe says * you!";)

or would you have to run the function twice?

i.e.

if ((llSubStringIndex(source, "Joe says";) > 0) and (llSubStringIndex(source, "you!";) > 0))

??

Thanks,
Buck
Kelly Linden
Linden Developer
Join date: 29 Mar 2004
Posts: 896
03-29-2006 23:01
It does not support wildcards.
_____________________
- Kelly Linden
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
03-29-2006 23:19
The pattern can't include wildcards. And I don't think there is any wildcards for string. If you want it to do something when there is the pattern which you're thinking like in the string, you can run the function twice. But note, your example can't be told the difference between source = "Joe says that to you!" and source = "Hey you!, Joe says that." And it is possible that it returns 0, so you should use "!= -1", not "> 0".
_____________________
:) Seagel Neville :)