Jump to content

How do I detect the index for a record in a list that contains a specific substring?


Life Camino
 Share

You are about to reply to a thread that has been inactive for 3485 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I want to match any portion of a string that is contained in a record in a list and identify which records contain the substring.  How do I do that?

 

I've used llListFindList to match whole strings and other data, but never just portions of a record.  So, any help would be appreciated.  Thanks.

Link to comment
Share on other sites

Does the list you are searching contain only single word entries or can an entry comprise several words?

ETA:  Actually, I don't think it matters.   Try this and see if it does what you want.

list findStringInList(string lookFor, list lookHere){	list temp =[];	integer max = llGetListLength(lookHere);	integer counter;	integer i;	do {		i = llSubStringIndex(llList2String(lookHere,counter),lookFor);//look		if(~i){			temp +=[counter];		}	}	while (++counter<max);	return temp;}

 

 ETA 2  Ron beat me to it.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3485 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...