Use indexOf and lastIndexOf to locate specific string : IndexOf lastIndexOf : String Flash / Flex / ActionScript examples


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

 

Use indexOf and lastIndexOf to locate specific string


 
package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){
        var sEmail:String = new String("info@your.com");

         
        var nCheckOne:Number = sEmail.indexOf("@");
        var nCheckTwo:Number = sEmail.lastIndexOf(".");
        if (nCheckOne!= -&& nCheckTwo!= -&& nCheckOne < nCheckTwo){
            trace("good email address");
        }

    }
  }
}

        



Leave a Comment / Note


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


Flash / Flex / ActionScript examples

 Navioo String
» IndexOf lastIndexOf