Find all the occurrences of a substring. : IndexOf lastIndexOf : String Flash / Flex / ActionScript examples


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

 

Find all the occurrences of a substring.


 

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){
        var sTitle:String = new String("ActionScript Bible");
        var nMatch:Number = sTitle.indexOf("i");
        while(nMatch != -1) {
          trace(nMatch);
          nMatch = sTitle.indexOf("i", nMatch + 1);
        }
         


    }
  }
}
3
9
14

        



Leave a Comment / Note


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


Flash / Flex / ActionScript examples

 Navioo String
» IndexOf lastIndexOf