org.mule.util
Class StringUtils

java.lang.Object
  extended by org.apache.commons.lang.StringUtils
      extended by org.mule.util.StringUtils

public class StringUtils
extends org.apache.commons.lang.StringUtils

StringUtils contains useful methods for manipulating Strings.


Field Summary
 
Fields inherited from class org.apache.commons.lang.StringUtils
EMPTY, INDEX_NOT_FOUND
 
Constructor Summary
StringUtils()
           
 
Method Summary
static byte[] hexStringToByteArray(String hex)
          Convert a hexadecimal string into its byte representation.
static String match(Pattern pattern, String value, int matchIndex)
          Matches the given value to the given pattern.
static String repeat(char c, int len)
          Like StringUtils.repeat(String, int) but with a single character as argument.
static String[] splitAndTrim(String string, String delim)
          Like StringUtils.split(String, String), but additionally trims whitespace from the result tokens.
static String toHexString(byte[] bytes)
           
static String toHexString(byte[] bytes, boolean uppercase)
          Convert a byte array to a hexadecimal string.
 
Methods inherited from class org.apache.commons.lang.StringUtils
abbreviate, abbreviate, capitalise, capitaliseAllWords, capitalize, center, center, center, chomp, chomp, chompLast, chompLast, chop, chopNewline, clean, concatenate, contains, contains, containsAny, containsAny, containsIgnoreCase, containsNone, containsNone, containsOnly, containsOnly, countMatches, defaultIfEmpty, defaultString, defaultString, deleteSpaces, deleteWhitespace, difference, endsWith, endsWithIgnoreCase, equals, equalsIgnoreCase, escape, getChomp, getCommonPrefix, getLevenshteinDistance, getNestedString, getNestedString, getPrechomp, indexOf, indexOf, indexOf, indexOf, indexOfAny, indexOfAny, indexOfAny, indexOfAnyBut, indexOfAnyBut, indexOfDifference, indexOfDifference, isAlpha, isAlphanumeric, isAlphanumericSpace, isAlphaSpace, isAsciiPrintable, isBlank, isEmpty, isNotBlank, isNotEmpty, isNumeric, isNumericSpace, isWhitespace, join, join, join, join, join, join, join, join, join, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOfAny, left, leftPad, leftPad, leftPad, length, lowerCase, mid, ordinalIndexOf, overlay, overlayString, prechomp, remove, remove, removeEnd, removeEndIgnoreCase, removeStart, removeStartIgnoreCase, repeat, replace, replace, replaceChars, replaceChars, replaceEach, replaceEachRepeatedly, replaceOnce, reverse, reverseDelimited, reverseDelimitedString, right, rightPad, rightPad, rightPad, split, split, split, split, splitByCharacterType, splitByCharacterTypeCamelCase, splitByWholeSeparator, splitByWholeSeparator, splitByWholeSeparatorPreserveAllTokens, splitByWholeSeparatorPreserveAllTokens, splitPreserveAllTokens, splitPreserveAllTokens, splitPreserveAllTokens, splitPreserveAllTokens, startsWith, startsWithIgnoreCase, strip, strip, stripAll, stripAll, stripEnd, stripStart, stripToEmpty, stripToNull, substring, substring, substringAfter, substringAfterLast, substringBefore, substringBeforeLast, substringBetween, substringBetween, substringsBetween, swapCase, trim, trimToEmpty, trimToNull, uncapitalise, uncapitalize, upperCase
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringUtils

public StringUtils()
Method Detail

splitAndTrim

public static String[] splitAndTrim(String string,
                                    String delim)
Like StringUtils.split(String, String), but additionally trims whitespace from the result tokens.


hexStringToByteArray

public static byte[] hexStringToByteArray(String hex)
Convert a hexadecimal string into its byte representation.

Parameters:
hex - The hexadecimal string.
Returns:
The converted bytes or null if the hex String is null.

repeat

public static String repeat(char c,
                            int len)
Like StringUtils.repeat(String, int) but with a single character as argument.


toHexString

public static String toHexString(byte[] bytes)
See Also:
toHexString(byte[])

toHexString

public static String toHexString(byte[] bytes,
                                 boolean uppercase)
Convert a byte array to a hexadecimal string.

Parameters:
bytes - The bytes to format.
uppercase - When true creates uppercase hex characters instead of lowercase (the default).
Returns:
A hexadecimal representation of the specified bytes.

match

public static String match(Pattern pattern,
                           String value,
                           int matchIndex)
                    throws IllegalArgumentException
Matches the given value to the given pattern. Then returns the group at matchIndex.

Parameters:
pattern - the pattern to use as regexp
value - the value to evaluate
matchIndex - the group index to be returned
Returns:
the value of the group at the given index. null if no match found
Throws:
IllegalArgumentException - if pattern or value are null.


Copyright © 2003-2014 MuleSoft, Inc.. All Rights Reserved.