public class StringHelper extends Object
| Constructor and Description |
|---|
StringHelper() |
| Modifier and Type | Method and Description |
|---|---|
static String |
arrayToSeparatedList(List list)
Convert an array of objects into a separated string using the default
separator and the entire array.
|
static String |
arrayToSeparatedList(List list,
int beginIndex,
int endIndex)
Convert an array of objects into a separated string using the default
separator.
|
static String |
arrayToSeparatedList(List list,
int beginIndex,
int endIndex,
String separator)
Convert an array of objects into a separated string.
|
static String |
arrayToSeparatedList(List list,
String separator)
Convert an array of objects into a separated string using the specified
separator and the entire array.
|
static String |
escape(String str)
Escaping given string by " and \.
|
static String |
getCapitalizedString(String aString)
Gets a version of the specified string with the first letter
capitalized.
|
static String |
intArrayToSeparatedList(int[] intArray,
int beginIndex,
int endIndex,
String separator)
Convert an array of int values into a separated string.
|
static String |
intArrayToSeparatedList(int[] intArray,
String separator)
Convert an array of int values into a separated string.
|
static boolean |
isEmpty(String aString)
Checks if a string is null or empty.
|
static String |
replace(String string,
String oldString,
String newString)
Replaces all occurences of
oldString in string
with newString. |
static String |
replaceFirst(String string,
String oldString,
String newString)
Replaces the first occurence of
oldString in string
with newString. |
static String |
rtrim(String input)
Trims trailing spaces from input.
|
static List |
separatedListToArray(String list)
Convert a separated string to an array of strings using the default
separator.
|
static List |
separatedListToArray(String list,
String separator)
Convert a separated string to an array of strings
|
public static String arrayToSeparatedList(List list, int beginIndex, int endIndex, String separator)
list - The list of objects to be expanded.beginIndex - The index of the first element in the list to be used.endIndex - The index of the last element in the list to be used.separator - The separator to be used between strings.public static String arrayToSeparatedList(List list, int beginIndex, int endIndex)
list - The list of objects to be expanded.beginIndex - The index of the first element in the list to be used.endIndex - The index of the last element in the list to be used.public static String arrayToSeparatedList(List list, String separator)
list - The list of objects to be expanded.separator - The separator to be used between strings.public static String arrayToSeparatedList(List list)
list - The list of objects to be expanded.public static List separatedListToArray(String list, String separator)
list - The string representing the list of objects.separator - The separator to be used to tokenize strings.public static List separatedListToArray(String list)
list - The string representing the list of objects.public static String intArrayToSeparatedList(int[] intArray, String separator)
intArray - The array of int values to be expanded.separator - The separator to be used between strings.public static String intArrayToSeparatedList(int[] intArray, int beginIndex, int endIndex, String separator)
intArray - The array of int values to be expanded.beginIndex - The index of the first element in the array to be used.endIndex - The index of the last element in the array to be used.separator - The separator to be used between strings.public static boolean isEmpty(String aString)
true if the string is null or empty after trim,
false otherwirse.public static String getCapitalizedString(String aString)
aString - the string to be capitalizedpublic static String replaceFirst(String string, String oldString, String newString)
oldString in string
with newString. The methods returns either a new string
instance (in the case oldString is included in the string)
or the origial string itself (in the case oldString is not
included).string - the original string.oldString - the string to be replaced.newString - the string the old value is replaced with.public static String replace(String string, String oldString, String newString)
oldString in string
with newString. The methods returns either a new string
instance (in the case oldString is included in the string)
or the origial string itself (in the case oldString is not
included).string - the original string.oldString - the string to be replaced.newString - the string the old value is replaced with.public static String rtrim(String input)
input - The input string.input.Copyright © 2017. All rights reserved.