public class StringHelper
extends java.lang.Object
| Constructor and Description |
|---|
StringHelper() |
| Modifier and Type | Method and Description |
|---|---|
static void |
appendCamelCase(java.lang.StringBuilder sb,
java.lang.String word)
Appends the given work to the specified StringBuilder in a camel case version.
|
static void |
appendCapitalized(java.lang.StringBuilder sb,
java.lang.String word)
Appends the given word to the specified
StringBuilder. |
static java.lang.String |
appendCapitalized(java.lang.String prefix,
java.lang.String... words)
Returns a string containing the given prefix, as is, and a capitalized version of the given
words.
|
static java.lang.String |
appendCapitalized(java.lang.String prefix,
java.lang.String word)
Returns a string containing the given prefix, as is, and a capitalized version of the given
word.
|
static java.lang.String |
appendCapitalized(java.lang.String prefix,
java.lang.String word1,
java.lang.String word2)
Returns a string containing the given prefix, as is, and a capitalized version of the given
word1 and word2.
|
static java.lang.String |
capitalize(java.lang.String word)
Returns a capitalized version of the given word.
|
static java.lang.String |
capitalizeWithSuffix(java.lang.String word,
java.lang.String suffix)
Returns a capitalized version of the given word, including the given
suffix
|
static <T> java.lang.String |
combineAsCamelCase(java.util.Collection<T> objectList,
java.util.function.Function<T,java.lang.String> mapFunction) |
static java.lang.String |
combineAsCamelCase(java.lang.Iterable<java.lang.String> stringList) |
static <T> void |
combineAsCamelCase(java.lang.StringBuilder sb,
java.util.Collection<T> objectList,
java.util.function.Function<T,java.lang.String> mapFunction) |
static java.util.List<java.lang.String> |
tokenizeCommandLineToEscaped(java.lang.String commandLine) |
static java.util.List<java.lang.String> |
tokenizeCommandLineToRaw(java.lang.String commandLine) |
static java.util.List<java.lang.String> |
toStrings(java.lang.Object... objects)
Returns a list of Strings containing the objects passed in argument.
|
static java.lang.String |
toSystemLineSeparator(java.lang.String input) |
public static void appendCapitalized(@NonNull
java.lang.StringBuilder sb,
@NonNull
java.lang.String word)
StringBuilder.
The word is capitalized before being appended.
sb - the StringBuilderword - the word to add@NonNull
public static java.lang.String capitalize(@NonNull
java.lang.String word)
This is unlikely to be what you need. Prefer to use appendCapitalized(StringBuilder, String) or one of appendCapitalized(String,
String), capitalizeWithSuffix(String, String) (String, String, String)}, or capitalizeWithSuffix(String, String).
word - the word to be capitalized@NonNull
public static java.lang.String appendCapitalized(@NonNull
java.lang.String prefix,
@NonNull
java.lang.String word)
prefix - the prefix to add before the wordword - the word to be capitalized@NonNull
public static java.lang.String appendCapitalized(@NonNull
java.lang.String prefix,
@NonNull
java.lang.String word1,
@NonNull
java.lang.String word2)
prefix - the prefix to add before the wordword1 - the word to be capitalizedword2 - the word to be capitalized@NonNull
public static java.lang.String appendCapitalized(@NonNull
java.lang.String prefix,
@NonNull
java.lang.String... words)
prefix - the prefix to add before the wordswords - the words to be capitalized@NonNull
public static java.lang.String capitalizeWithSuffix(@NonNull
java.lang.String word,
@NonNull
java.lang.String suffix)
word - the word to be capitalizedsuffix - the suffix to add after the wordpublic static void appendCamelCase(@NonNull
java.lang.StringBuilder sb,
@NonNull
java.lang.String word)
if the builder is empty, the word is added as-is. If it's not then the work is capitalized
sb - the StringBuilderword - the word to add@NonNull
public static java.lang.String combineAsCamelCase(@NonNull
java.lang.Iterable<java.lang.String> stringList)
@NonNull
public static <T> java.lang.String combineAsCamelCase(@NonNull
java.util.Collection<T> objectList,
@NonNull
java.util.function.Function<T,java.lang.String> mapFunction)
public static <T> void combineAsCamelCase(@NonNull
java.lang.StringBuilder sb,
@NonNull
java.util.Collection<T> objectList,
@NonNull
java.util.function.Function<T,java.lang.String> mapFunction)
@NonNull
public static java.util.List<java.lang.String> toStrings(@NonNull
java.lang.Object... objects)
If the objects are strings, they are directly added to the list. If the objects are collections of strings, the strings are added. For other objects, the result of their toString() is added.
objects - the objects to addpublic static java.util.List<java.lang.String> tokenizeCommandLineToEscaped(@NonNull
java.lang.String commandLine)
public static java.util.List<java.lang.String> tokenizeCommandLineToRaw(@NonNull
java.lang.String commandLine)
public static java.lang.String toSystemLineSeparator(@NonNull
java.lang.String input)