Improved PDF export (every article is a chapter, outline, FileDialog)
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.wiki / src / net / sourceforge / phpeclipse / wiki / renderer / StringUtil.java
diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/renderer/StringUtil.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/renderer/StringUtil.java
new file mode 100644 (file)
index 0000000..bcb3046
--- /dev/null
@@ -0,0 +1,42 @@
+package net.sourceforge.phpeclipse.wiki.renderer;
+
+public class StringUtil {
+
+  /**
+   * @param body
+   * @param j
+   * @return
+   */
+  public static boolean checkNoContent(String body) {
+    char ch;
+    boolean noContent = true;
+    int j = 0;
+    try {
+      while (true) {
+        ch = body.charAt(j++);
+        if (!Character.isWhitespace(ch)) {
+          if (ch == '<' && body.charAt(j) == '!' && body.charAt(j + 1) == '-' && body.charAt(j + 2) == '-') {
+            //<!-- ... -->
+            j += 3;
+            while (true) {
+              ch = body.charAt(j++);
+              if (ch == '-' && body.charAt(j) == '-' && body.charAt(j + 1) == '>') {
+                j += 2;
+                break;
+              }
+            }
+          } else if (ch == '<' && body.charAt(j) == 'b' && body.charAt(j + 1) == 'r' && body.charAt(j + 2) == '>') {
+            // <br>
+          } else {
+            noContent = false;
+            break;
+          }
+        }
+      }
+    } catch (IndexOutOfBoundsException e) {
+  
+    }
+    return noContent;
+  }
+
+}