Created
September 1, 2010 08:00
-
-
Save brianhsu/560382 to your computer and use it in GitHub Desktop.
WTF1 Java 版
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
| /**************************************************************************** | |
| * What THE FUCK Java Code!!! | |
| * | |
| * 這是人寫出來的嗎?有誰可以猜出這個函式在做什麼嗎?! | |
| * Note: 而且還只能在 Windows 上才 Work 喲,啾咪。 | |
| ***************************************************************************/ | |
| public static String isNotBig5(String ori) | |
| { | |
| char[] c = ori.toCharArray(); | |
| char[] c1 = new char[1]; | |
| StringBuffer sb = new StringBuffer(); | |
| for (int i = 0; i < c.length; i++) { | |
| c1[0] = c[i]; | |
| //System.out.println(c1[0]+" "+(int)c1[0]); // | |
| String onechar = ""; | |
| try { | |
| onechar = new String( (new String(c1)).getBytes() , "Big5"); | |
| } | |
| catch (Exception e) {} | |
| if (onechar.equals("?") && (int)c[i] != 63) { // ?是正常的"?" //modified by ciyan 2008.03.04 | |
| sb.append("&#"); | |
| sb.append(Integer.toString(c1[0])); | |
| sb.append(";"); | |
| } | |
| else { | |
| sb.append(c1[0]); | |
| } | |
| } | |
| return sb.toString(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment