Use offset in lastIndexOf method
package{
import flash.display.Sprite;
public class Main extends Sprite{
public function Main(){
var example:String = "This string contains the word cool. Very cool. Yes, cool.";
var index:int = example.length;
while ( ( index = example.lastIndexOf( "cool", index - 1 ) ) != -1 ) {
trace( "String contains word cool at index " + index );
}
}
}
}
Related examples in the same category