[Htmlparser-cvs] htmlparser/src/org/htmlparser/tags Tag.java,1.24,1.25
Brought to you by:
derrickoswald
From: <der...@us...> - 2003-05-17 12:12:53
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags In directory sc8-pr-cvs1:/tmp/cvs-serv30035/org/htmlparser/tags Modified Files: Tag.java Log Message: Fix tab handling on the suggestion of oyoaha (philippe blanc). Rewrite some string handling methods to remove gross inefficiencies. Index: Tag.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/Tag.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Tag.java 12 May 2003 01:37:46 -0000 1.24 --- Tag.java 17 May 2003 12:12:50 -0000 1.25 *************** *** 238,250 **** } ! public static String extractWord(String s) { ! String word = ""; ! boolean parse=true; ! for (int i=0;i<s.length() && parse==true;i++) { ! char ch = s.charAt(i); ! if (ch==' ' || ch=='\r' || ch=='\n' || ch=='=') parse = false; else word +=ch; } ! word = word.toUpperCase(); ! return word; } --- 238,267 ---- } ! /** ! * Extract the first word from the given string. ! * Words are delimited by whitespace or equals signs. ! * @param s The string to get the word from. ! * @return The first word. ! */ ! public static String extractWord (String s) ! { ! int length; ! boolean parse; ! char ch; ! StringBuffer ret; ! ! length = s.length (); ! ret = new StringBuffer (length); ! parse = true; ! for (int i = 0; i < length && parse; i++) ! { ! ch = s.charAt (i); ! if (Character.isWhitespace (ch) || ch == '=') ! parse = false; ! else ! ret.append (Character.toUpperCase (ch)); } ! ! return (ret.toString ()); } |