Use offset index in indexOf method to search substring : IndexOf lastIndexOf : String Flash / Flex / ActionScript examples


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

 

Use offset index in indexOf method to search substring


 

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){
        var example:String = "This string contains the word cool twice. Very cool.";
        var index:int = example.indexOf"cool" );
        
        if index != -) {
          trace"String contains word cool at index " + index );
        }
        
        index = example.indexOf"cool", index + );
        
        if 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


Warning: Unknown: write failed: No space left on device (28) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php/session) in Unknown on line 0