Here you can find the source of urlEncodeForSpaces(String input)
"%20"
.
Parameter | Description |
---|---|
input | the input string |
public static String urlEncodeForSpaces(String input)
//package com.java2s; public class Main { /**//from w ww .j a va 2 s .c o m * This method encodes the url, removes the spaces from the url and replaces * the same with <code>"%20"</code>. * * @param input the input char array * @return the string */ public static String urlEncodeForSpaces(char[] input) { StringBuffer retu = new StringBuffer(input.length); for (int i = 0; i < input.length; i++) { if (input[i] == ' ') { retu.append("%20"); } else { retu.append(input[i]); } } return retu.toString(); } /** * This method encodes the url, removes the spaces from the url and replaces * the same with <code>"%20"</code>. * * @param input the input string * @return the string */ public static String urlEncodeForSpaces(String input) { return urlEncodeForSpaces(input.toCharArray()); } }