Use offset in lastIndexOf method : IndexOf lastIndexOf : String Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » String » IndexOf lastIndexOf »

 

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 - ) ) != -) {
          trace"String contains word cool at index " + index );
        }
    }
  }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo String
» IndexOf lastIndexOf