integer llSubStringIndex(string source, string pattern)
the index in source
first appears. Returns -1
if no match is found.
Remember, strings (and lists
) are indexed starting from 0.
is relatively slow.
Q: "Relatively slow?" How exactly does this differ from the rest of LSL? :)
A: Actually, the execution of LSL functions themselves is quite fast, unless they have a built-in delay, as in the case of llInstantMessage, for example. The slow part (because of little allocation of timeslices because of the huge number of scripts a simulator runs in parallel) is the execution of the script's bytecode itself (loops, math, moving data in memory, etc.). So, unlike others functions, llSubStringIndex is likely simply slow in its execution, though it's possible that the slowness is due to an unknown built-in delay.
A2: In my own tests, this function performed 4.3 times slower than llGetSubString, completing 100 iterations in an average of 2.2 seconds on an open space sim versus 0.51 seconds. However, llDeleteSubString appears to perform even slower than this function, completing 100 iterations in an average of 2.3 seconds.
Compare with llListFindList
This article wasn't helpful for you? Maybe the related article at the LSL Portal
is able to bring enlightenment.