On Nov 10, 2008, at 1:30 PM, Sergiu Dumitriu wrote:
asiri (SVN) wrote:
You should use StringUtils.stripEnd and stripStart for this.
He should be careful when using those methods with null as the second
param since it may strip more than he wants for HTML.
-Vincent
Added:
sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/
xwiki/plugin/officeimporter/utils/ImporterUtils.java
===================================================================
--- sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/
plugin/officeimporter/utils/
ImporterUtils.java (rev 0)
+++ sandbox/xwiki-plugin-officeimporter/src/main/java/com/xpn/xwiki/
plugin/officeimporter/utils/ImporterUtils.java 2008-11-10 12:09:35
UTC (rev 14068)
@@ -0,0 +1,36 @@
+package com.xpn.xwiki.plugin.officeimporter.utils;
+
+/**
+ * Utility methods common for office importer.
+ *
+ * @version $Id$
+ * @since 1.7M1
+ */
+public abstract class ImporterUtils
+{
+ public static String leftTrim(String s)
+ {
+ String content = s.trim();
+ if (content.equals("")) {
+ return "";
+ } else {
+ int index = s.indexOf(content);
+ if(index == 0) {
+ return s;
+ } else {
+ return s.substring(index);
+ }
+ }
+ }
+
+ public static String rightTrim(String s)
+ {
+ String content = s.trim();
+ if (content.equals("")) {
+ return "";
+ } else {
+ int index = s.indexOf(content);
+ return s.substring(0, index + content.length());
+ }
+ }
+}
--
Sergiu Dumitriu
http://purl.org/net/sergiu/
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs