You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by dk...@apache.org on 2011/09/20 00:28:28 UTC
svn commit: r1172864 -
/camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/util/StringHelper.java
Author: dkulp
Date: Mon Sep 19 22:28:27 2011
New Revision: 1172864
URL: http://svn.apache.org/viewvc?rev=1172864&view=rev
Log:
Fix compile error
Modified:
camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/util/StringHelper.java
Modified: camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/util/StringHelper.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/util/StringHelper.java?rev=1172864&r1=1172863&r2=1172864&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/util/StringHelper.java (original)
+++ camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/util/StringHelper.java Mon Sep 19 22:28:27 2011
@@ -76,6 +76,20 @@ public final class StringHelper {
return s;
}
+ public static String removeLeadingAndEndingQuotes(String s) {
+ if (ObjectHelper.isEmpty(s)) {
+ return s;
+ }
+
+ if (s.startsWith("'") && s.endsWith("'")) {
+ return s.substring(1, s.length() - 1);
+ }
+ if (s.startsWith("\"") && s.endsWith("\"")) {
+ return s.substring(1, s.length() - 1);
+ }
+ return s;
+ }
+
/**
* Encodes the text into safe XML by replacing < > and & with XML tokens
*
@@ -110,4 +124,27 @@ public final class StringHelper {
return false;
}
+ /**
+ * Does the expression have the language start token?
+ *
+ * @param expression the expression
+ * @param language the name of the language, such as simple
+ * @return <tt>true</tt> if the expression contains the start token, <tt>false</tt> otherwise
+ */
+ public static boolean hasStartToken(String expression, String language) {
+ if (expression == null) {
+ return false;
+ }
+
+ if (expression.indexOf("${") >= 0) {
+ return true;
+ }
+
+ if (language != null && expression.indexOf("$" + language + "{") >= 0) {
+ return true;
+ }
+
+ return false;
+ }
+
}