�
/** * This method decodes the URL encoded format. * i.e. %XX -> char and + to space * @param decode The String to decode. * @return The decoded String. */ char nextChar; String encString; Integer encInteger; // Go through the String character by character. for(int index=0; index < decode.length(); index++) { // Get the next character in the String. nextChar = decode.charAt(index); // If the character is +, then convert it to // a space. if (nextChar == '+') { decoded.append(" "); } // If the character is a %, then the next two // characters store the value of the encoded // character. else if (nextChar == '%') { // Create an Integer object containing the // integer value of the next two characters // in the string, assuming a base 16 notation. decode.substring(index+1,index+3),URL_BASE); // Increment our counter by 2 - we just read // two characters. index += 2; // Return the int value within the Integer // and then cast that into a char type. nextChar = (char)encInteger.intValue(); // Add the coded character. decoded.append(nextChar); } // Otherwise, just add the character. else { decoded.append(nextChar); } } // Return the decoded string. return decoded.toString(); } }
�
�
Apparence :
Membres :
ConnexionNouveaux :
S'enregistrer�
Infos :
15180 documents (?)