Created
April 8, 2011 07:12
-
-
Save cutmail/909427 to your computer and use it in GitHub Desktop.
Revisions
-
cutmail created this gist
Apr 8, 2011 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ public static String trimUni(String s){ int len = s.length(); int st = 0; char[] val = s.toCharArray(); while (st < len && (val[st] <= ' ' || val[st] == ' ')) { st++; } while (st < len && (val[len - 1] <= ' ' || val[len - 1] == ' ')) { len--; } if(st > 0 || len < s.length()) { return s.substring(st, len); } return s; }