org.apache.camel.util
Class StringHelper

java.lang.Object
  extended by org.apache.camel.util.StringHelper

public final class StringHelper
extends Object

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 hasUpperCase(String text)
          Determines if the string has at least one letter in upper case
static String removeQuotes(String s)
           
static String sanitize(String s)
          Ensures that s is friendly for a URL or file system.
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

sanitize

public static String sanitize(String s)
Ensures that s is friendly for a URL or file system.

Parameters:
s - String to be sanitized.
Returns:
sanitized version of s.
Throws:
NullPointerException - if s is null.

countChar

public static int countChar(String s,
                            char ch)
Counts the number of times the given char is in the string

Parameters:
s - the string
ch - the char
Returns:
number of times char is located in the string

removeQuotes

public static String removeQuotes(String s)

xmlEncode

public static String xmlEncode(String text)
Encodes the text into safe XML by replacing < > and & with XML tokens

Parameters:
text - the text
Returns:
the encoded text

hasUpperCase

public static boolean hasUpperCase(String text)
Determines if the string has at least one letter in upper case

Parameters:
text - the text
Returns:
true if at least one letter is upper case, false otherwise


Apache CAMEL