|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.camel.util.StringHelper
public final class StringHelper
Helper methods for working with Strings.
Method Summary | |
---|---|
static int |
countChar(String s,
char ch)
Counts the number of times the given char is in the string |
static boolean |
hasStartToken(String expression,
String language)
Does the expression have the language start token? |
static boolean |
hasUpperCase(String text)
Determines if the string has at least one letter in upper case |
static boolean |
isQuoted(String s)
|
static String |
removeLeadingAndEndingQuotes(String s)
|
static String |
removeQuotes(String s)
|
static String |
replaceAll(String input,
String from,
String to)
Replaces all the from tokens in the given input string. |
static String |
sanitize(String s)
Ensures that s is friendly for a URL or file system. |
static String |
toJson(String name,
String value,
boolean isMap)
Creates a json tuple with the given name/value pair. |
static String |
xmlEncode(String text)
Encodes the text into safe XML by replacing < > and & with XML tokens |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static String sanitize(String s)
s
is friendly for a URL or file system.
s
- String to be sanitized.
s
.
NullPointerException
- if s
is null
.public static int countChar(String s, char ch)
s
- the stringch
- the char
public static String removeQuotes(String s)
public static String removeLeadingAndEndingQuotes(String s)
public static boolean isQuoted(String s)
public static String xmlEncode(String text)
text
- the text
public static boolean hasUpperCase(String text)
text
- the text
public static boolean hasStartToken(String expression, String language)
expression
- the expressionlanguage
- the name of the language, such as simple
public static String replaceAll(String input, String from, String to)
input
- the input stringfrom
- the from string, must not be null or emptyto
- the replacement string, must not be empty
IllegalArgumentException
- if the input arguments is invalidpublic static String toJson(String name, String value, boolean isMap)
name
- the namevalue
- the valueisMap
- whether the tuple should be map
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |