Created
June 15, 2011 09:03
-
-
Save wuyongzheng/1026751 to your computer and use it in GitHub Desktop.
Decode xiami xml's location url
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static String dexiami (String code) | |
| { | |
| int i2 = Integer.parseInt(code.substring(0, 1)); | |
| code = code.substring(1); | |
| int i4 = code.length() / i2; | |
| int i5 = code.length() % i2; | |
| String [] arr = new String [i2]; | |
| for (int count = 0; count < i5; count ++) | |
| arr[count] = code.substring((i4 + 1) * count, (i4 + 1) * (count + 1)); | |
| for (int count = i5; count < i2; count ++) | |
| arr[count] = code.substring(i4 * count + i5, i4 * (count + 1) + i5); | |
| String txt = ""; | |
| for (int count = 0; count < i4 + 1; count ++) { | |
| for (int j = 0; j < i2; j ++) { | |
| if (count < arr[j].length()) | |
| txt += arr[j].charAt(count); | |
| } | |
| } | |
| txt = java.net.URLDecoder.decode(txt, "UTF-8"); | |
| txt = txt.replace('^', '0'); | |
| txt = txt.replace('+', ' '); // not sure if this is needed | |
| return txt; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment