public class StringUtils extends Object
StringUtils contains useful methods for manipulating Strings.| Modifier and Type | Field and Description |
|---|---|
static String |
DASH |
static String |
EMPTY |
static String |
WHITE_SPACE |
| Constructor and Description |
|---|
StringUtils() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
hexStringToByteArray(String hex)
Convert a hexadecimal string into its byte representation.
|
static void |
ifNotBlank(String value,
Consumer<String> consumer)
|
static boolean |
isBlank(String str) |
static boolean |
isEmpty(String str) |
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.
|
static String |
trim(String str) |
public static final String WHITE_SPACE
public static final String DASH
public static final String EMPTY
public static String[] splitAndTrim(String string, String delim)
StringUtils.split(String, String), but additionally trims whitespace from the result
tokens.public static byte[] hexStringToByteArray(String hex)
hex - The hexadecimal string.null if the hex String is null.public static String repeat(char c, int len)
StringUtils.repeat(String, int) but with a single character as argument.public static String toHexString(byte[] bytes)
toHexString(byte[])public static String toHexString(byte[] bytes, boolean uppercase)
bytes - The bytes to format.uppercase - When true creates uppercase hex characters instead of lowercase (the default).public static String match(Pattern pattern, String value, int matchIndex) throws IllegalArgumentException
pattern - the pattern to use as regexpvalue - the value to evaluatematchIndex - the group index to be returnednull if no match foundIllegalArgumentException - if pattern or value are null.public static void ifNotBlank(String value, Consumer<String> consumer)
value - a valueconsumer - a String Consumerpublic static boolean isEmpty(String str)
public static boolean isBlank(String str)
Copyright © 2003–2017 MuleSoft, Inc.. All rights reserved.