public class Strings extends Object
Constructor and Description |
---|
Strings() |
Modifier and Type | Method and Description |
---|---|
static String |
convertToCamelCase(String text,
String separator)
Converts the given text with the given separator into camelCase
|
static String |
defaultIfEmpty(String value,
String defaultValue) |
static String |
emptyIfNull(String value) |
static String |
firstNonBlank(String... values)
Returns the first string value which is not null and not blank
|
static boolean |
isNotBlank(String text) |
static boolean |
isNullOrBlank(String value) |
static String |
join(Collection<?> collection,
String separator)
joins a collection of objects together as a String using a separator
|
static String |
join(String separator,
Object... objects)
joins a collection of objects together as a String using a separator
|
static String |
joinNotNull(String separator,
Object... objects)
joins a collection of objects together as a String using a separator, filtering out null values
|
static boolean |
notEmpty(String text)
Returns true if the given text is not null and not empty
|
static String |
nullIfEmpty(String value) |
static List<String> |
parseDelimitedString(String value,
String delim) |
static List<String> |
parseDelimitedString(String value,
String delim,
boolean trim)
Parses delimited string and returns an array containing the tokens.
|
static String |
replaceAllWithoutRegex(String text,
String from,
String to)
Replaces all occurrencies of the from text with to text without any regular expressions
|
static String |
rpad(String delimiter,
String str,
int max)
This method is used to pad a line by max length with a delimiter.
|
static String |
rpadByMaxSize(String delimiter,
String str,
int max)
When you have a line that has a maximum length and want to pad the remaining space with ' ' whitespace then
this method is for you.
|
static List<String> |
splitAndTrimAsList(String text,
String sep)
splits a string into a list of strings.
|
static List<String> |
splitAsList(String text,
String delimiter)
splits a string into a list of strings, ignoring the empty string
|
static String |
splitCamelCase(String text)
Splits a CamelCase string using a space between them.
|
static String |
splitCamelCase(String text,
String separator)
Splits a CamelCase string using a separator string between them.
|
static String |
stripPrefix(String value,
String suffix) |
static String |
stripSuffix(String value,
String suffix) |
static Function<String,String> |
toEnvironmentVariableFunction()
Converts a string to a valid environment variable by removing bad characters like '.' and ' '
|
static Function<String,String> |
toLowerCaseFunction() |
static String |
toString(Object object) |
static Function<String,String> |
toUpperCaseFunction() |
static String |
unquote(String text) |
public static boolean notEmpty(String text)
public static String firstNonBlank(String... values)
public static List<String> splitAsList(String text, String delimiter)
public static List<String> splitAndTrimAsList(String text, String sep)
public static String join(Collection<?> collection, String separator)
public static String join(String separator, Object... objects)
public static String joinNotNull(String separator, Object... objects)
public static String rpad(String delimiter, String str, int max)
delimiter
- - String that will be used to concatenate to the end of linestr
- - string input that will be changed and returnedmax
- - size of the maximum length of a stringpublic static String rpadByMaxSize(String delimiter, String str, int max)
delimiter
- - String that will be used to concatenate to the end of linestr
- - string input that will be changed and returnedmax
- - size of the maximum length of a stringpublic static boolean isNullOrBlank(String value)
public static boolean isNotBlank(String text)
public static List<String> parseDelimitedString(String value, String delim, boolean trim)
value
- the delimited string to parse.delim
- the characters delimiting the tokens.public static String convertToCamelCase(String text, String separator)
public static String splitCamelCase(String text)
public static String splitCamelCase(String text, String separator)
public static Function<String,String> toEnvironmentVariableFunction()
Copyright © 2011–2015 Red Hat. All rights reserved.