code for replacement of characters with '-',in a string..

tempString="pavanKTilak"+"-";
        System.out.println("--------old String----"+tempString);
      //convert string into array using toCharArray() method of string class
        stringArray = tempString.toCharArray();
        char c=tempString.charAt(tempString.length()-2);
        stringArray[tempString.length()-2]=stringArray[tempString.length()-1];
        stringArray[tempString.length()-1]=c;
       
        //code to convert charArray back to String..
        tempString=new String(stringArray);///stringArray.toString();
        System.out.println("--------new String----"+tempString);
        tempString=new String("yrieuwy");///stringArray.toString();
        System.out.println("--------new String----"+tempString);

Comments

Popular posts from this blog

Custom Dialog with no title and full screen in Android

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

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