Here you can find the source of urlEncodeForSpaces(String href)
private static String urlEncodeForSpaces(String href)
//package com.java2s; /**/*from w w w . ja v a 2 s . c o m*/ * This program and the accompanying materials * are made available under the terms of the License * which accompanies this distribution in the file LICENSE.txt */ public class Main { private static String urlEncodeForSpaces(String href) { return urlEncodeForSpaces(href.toCharArray()); } private 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"); //$NON-NLS-1$ } else { retu.append(input[i]); } } return retu.toString(); } }