all groups > flash actionscript > november 2004 >
You're in the

flash actionscript

group:

Search using IndexOf() action



Re: Search using IndexOf() action NSurveyor
11/28/2004 7:23:17 PM
flash actionscript: You could do something like this:

//User puts this in:
query = "WHAT I WANT TO FIND";
//-------------------------------------------
//-What actionscript should do:
actualquery = " "+query+" ";
myString.indexOf(actualquery,0);
Re: Search using IndexOf() action NSurveyor
11/28/2004 7:25:10 PM
Made a minor mistake:
Do something like this:
//User puts this in:
query = "WHAT I WANT TO FIND";
//-------------------------------------------
//-What actionscript should do:
actualquery = " "+query+" ";
resulted = myString.indexOf(actualquery,0)+1;
trace("You search query: "+query+" was found at index "+resulted
Search using IndexOf() action Luka
11/28/2004 7:40:17 PM
I made Flash Search using indexOf() action. For example, if I search next
strings:



Philip Dik Do Androids Dream Of Electric Sheep
Macromedia Dreamweaver For Beginners



for query "Dream", I'll get both sentences (strings) as search result
(containing "dream" and "dreamweaver").



How can I modify indexOf() action to match exact word only so the result for
query "Dream" would be only first string:



Philip Dik Do Androids Dream Of Electric Sheep?

Thanks
Luka




Re: Search using IndexOf() action NSurveyor
11/28/2004 8:59:19 PM
Re: Search using IndexOf() action Luka
11/28/2004 9:03:53 PM
Thank you very much!!! It works fine, i also added:
myString = [" "+myString+" "]

before the:
resulted = myString.indexOf(actualquery,0)+1;
for the words at the beginning (with no "space" before it) and the words at
the end of the string (with no "space" after it), to be also shown as the
search result.

Thanks!
Luka



[quoted text, click to view]

AddThis Social Bookmark Button