Java URL Encode urlEncodeForSpaces(String href)

Here you can find the source of urlEncodeForSpaces(String href)

Description

url Encode For Spaces

License

Open Source License

Declaration

private static String urlEncodeForSpaces(String href) 

Method Source Code

//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();
    }
}

Related

  1. urlEncode(String str)
  2. urlEncode(String str)
  3. urlEncode(String urlPlain)
  4. urlEncodeFilename(char[] input)
  5. URLEncodeFilePath(String s)
  6. urlEncodeForSpaces(String input)
  7. urlEncodeForSpaces(String input)
  8. urlEncodeParameter(String value)
  9. URLEncoder(String str)