code for replacement of characters,in a string..

tempString="pavanKTilak"+"0";
        System.out.println("-----tempString---"+tempString);
        char c=tempString.charAt(tempString.length()-2);
        System.out.println("-----tempString.charAt(tempString.length()-2)---"+tempString.charAt(tempString.length()-2));
      //convert string into array using toCharArray() method of string class
        stringArray = tempString.toCharArray();
        //stringArray[tempString.length()]
       
       
        System.out.println("-----c---"+c);
                            ///old                      new
        tempString=tempString.replace(tempString.charAt(tempString.length()-2), '-');
        System.out.println("-----updatedStr---"+tempString);
        tempString=tempString.replace(tempString.charAt(tempString.length()-1), c);
        System.out.println("-----tempString---"+tempString);
        //tempString[0]=tempString[9];

Comments

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