List of utility methods to do URL Encode
String | URLEncode(String in) Encodes a string as follows: - The ASCII characters 'a' through 'z', 'A' through 'Z', '0' through '9', and ".", "-", "*", "_" remain the same. char[] chars = in.toCharArray(); char c = ' '; StringBuffer out = new StringBuffer(); for (int i = 0; i < chars.length; i++) { c = chars[i]; if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9')) { out.append(c); } else if (c == ' ') { ... |
String | urlEncode(String origString) url Encode StringBuffer sb = new StringBuffer(); int len = origString.length(); for (int i = 0; i < len; i++) { char c = origString.charAt(i); if (c == ' ') sb.append("%20"); else sb.append(c); ... |
String | URLencode(String s) URL-encodes the given string if (s != null) { StringBuffer tmp = new StringBuffer(); int i = 0; try { while (true) { int b = (int) s.charAt(i++); if ((b >= 0x30 && b <= 0x39) || (b >= 0x41 && b <= 0x5A) || (b >= 0x61 && b <= 0x7A)) { tmp.append((char) b); ... |
String | urlEncode(String str) url Encode str = str.replace('+', '-').replace('/', '_'); return str.replace("=", ""); |
String | urlEncode(String str) url Encode StringBuffer buf = new StringBuffer(); char c; for (int i = 0; i < str.length(); i++) { c = str.charAt(i); if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) { buf.append(c); } else { buf.append("%").append(Integer.toHexString((int) str.charAt(i))); ... |
String | urlEncode(String str) url Encode if (str == null) return null; StringBuffer tmp = new StringBuffer(); for (int i = 0; i < str.length(); ++i) { char a = str.charAt(i); if (((a < ':') && (a > '/')) || ((a < '[') && (a > '@')) || ((a < '{') && (a > '`')) || (a == '_')) tmp.append(a); else if (a < '\16') ... |
String | urlEncode(String urlPlain) url Encode String output = null; output = urlPlain.replace("?", "?"); return output; |
String | urlEncodeFilename(char[] input) This method encodes the URL, removes the spaces and brackets from the URL and replaces the same with "%20" and "%5B" and "%5D" and "%7B" "%7D" .
if (input == null) { return null; StringBuffer retu = new StringBuffer(input.length); for (int i = 0; i < input.length; i++) { if (input[i] == ' ') { retu.append("%20"); } else if (input[i] == '[') { ... |
String | URLEncodeFilePath(String s) given a string representing a path to a file, returns the url string for it. String s1 = s.replace("#", "%23"); s1 = s1.replace("?", "%3F"); return s1; |
String | urlEncodeForSpaces(String href) url Encode For Spaces return urlEncodeForSpaces(href.toCharArray());
|