code to search is given string exists or not in a Sentence in Android

String haystack = "/mnt/sdcard/M_T_SURYA/M_T_SURYA/.DS_Store ";
        String needle1 = ".DS_Store";        
        int index1 = haystack.indexOf(needle1);      
        if (index1 != -1)
            System.out.println("The string contains the substring " + needle1);
            System.out.println("The string does not contain the substring " + needle1);*/
        /*///code to devide a String into different parts based on given symbol (eg:'/')..
        String str = "";
        StringTokenizer st = new StringTokenizer(str, "/");
        System.out.println("Tokens Count:  " + st.countTokens());
        String arrayString[]=new String[st.countTokens()];
        String lastString=null;
        int tokenCount=st.countTokens();
        for(int i=0;i<tokenCount;i++)
             System.out.println("lastString :  " + lastString);
        st = new StringTokenizer(lastString, ".");
        String folderName=st.nextToken();
        System.out.println("folderName :  " + folderName);


Popular posts from this blog

Custom Dialog with no title and full screen in Android

code to display .pdf,.text,.DOC,.DOCX,.doc extension files exists in SDCard

Best working code to set Date limits on Date Picker Dialog,in Android