1 person found this helpful
You can use the indexOf() method of the String class to determine if the string is a substring... -1 is returned if the string is not found
var str1 = "file:///C|/Project/slideShow2.swf";
var str2 = "Project/slideShow2.swf";
var str3 = "Project/slidShow2.swf";
trace(str1.indexOf("slideShow2.swf")); // 19
trace(str2.indexOf("slideShow2.swf")); // 8
trace(str3.indexOf("slideShow2.swf")); // -1
Thanks for replying Ned. That wouldn't work for me because I won't know what the index of the first character of my string will be. If there's a index of last character then the index would be that char -14. I'll bet there's a string lenth attribute if I just subtract 14 from that I'll have my indexOf.
If any other ideas come to mind let me know. I don't know AS2 very well and didn't realize I'd need to know it someday so I'm scrambling to learn what I need quickly.
I got it I just used the .lenth property then subtracted 14. Thanks for your help.
I'm sorry you had the correct answer. I'm such a dufas.
No, if the indexOf returns anything positive (0+), you know that string is within the string you are testing. That's all you said you wanted to know. If you want to know where it is, the indexOf tells you that as well.