asiri (SVN) wrote:
You should use StringUtils.stripEnd and stripStart for this.
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/