package net.sourceforge.phpeclipse.wiki.actions.category; import java.util.ArrayList; public class ParseCategory { ArrayList titleList; public ParseCategory() { titleList = new ArrayList(); } public void parseCategory(String text) { int index1 = text.indexOf("contentSub"); int index2 = text.indexOf("printfooter"); if (index2 < 0) { index2 = text.length(); } if (index1 > 0 && index2 > index1) { try { int i = index1; int titleStart; int titleEnd; char ch; while (true) { ch = text.charAt(i++); if (i>index2) { break; } if (ch == 't' && text.charAt(i) == 'i' && text.charAt(i +1) == 't' && text.charAt(i + 2) == 'l' && text.charAt(i + 3) == 'e') { i += 4; titleStart = -1; // found: "title" while (true) { ch = text.charAt(i++); if (ch=='"') { if (titleStart>0) { titleList.add(text.substring(titleStart,i-1)); break; } titleStart = i; } } } } } catch (IndexOutOfBoundsException e) { } } } public static void main(String[] args) { String test = "\r\n" + "\r\n" + "
\r\n" + " \r\n" + " \r\n" + "\r\n" + "\r\n" + "\r\n" + "\r\n" + "\r\n" + "(Dieser Artikel enthält momentan keinen Text)
\r\n"
+ "