SSISO Community

시소당

Match Email address

/**
      *  SubStringDemo.java  separates  domain  name  like  "@yahoo.com"
      *  from  email  id  like  "suraj.gupta@yahoo.com"
      *
      */      
    public  class  SubStringDemo  {
                /**
                  *  @author  suraj.gupta
                  */
          public  static  void  main(String[]  args)  {
                String  s  =  "suraj.gupta@yahoo.com";  //  email  id  in  a  String
                int  IndexOf  =  s.indexOf("@");  //  returns  an  integer  which  tells  the  position  of  this  substring  "@"  in  the  parent  String  "suraj.gupta@yahoo.com"
                String  domainName  =  s.substring(IndexOf);  //prints  the  String  after  that  index
                System.out.println("Taking  Domain  name  from  an  email  id  "+domainName);
          }
    }

[2008년  04월  04일  09:32:53  수정되었습니다.]

730 view

4.0 stars