public final class StringUtil extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
StringUtil.SplitPredicate
This interface allows that
splitByDelimiters(String, List) to consume data an indicate whether to further add new characters or consume
the currentData. |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isNotNullOrEmpty(String data)
Determines if the given
String is not null or empty. |
static boolean |
isNullOrEmpty(String data)
Determines if the given
String is null or empty. |
static String |
replaceLast(String source,
char toReplace,
char toUse)
Replaces the last occurrence of a character in the given source.
|
static String |
replaceLast(String source,
String toReplace,
String toUse)
Replaces the last occurrence of a character in the given source.
|
static List<String> |
splitByDelimiters(String data,
List<Character> delimiters)
|
static List<String> |
splitByDelimiters(String data,
List<Character> delimiters,
StringUtil.SplitPredicate consumePredicate)
|
static String |
stripStringIndicators(String data)
Strips the " characters at the start and end of the given string if present.
|
public static String replaceLast(String source, char toReplace, char toUse)
source - source which contains the data to be usedtoReplace - the character that is to be replacedtoUse - the character that is used insteadString where last occurrence of the given character is replaced by the provided character or the original string if its null or does not contain the characterpublic static String replaceLast(String source, String toReplace, String toUse)
source - source which contains the data to be usedtoReplace - the character that is to be replacedtoUse - the character that is used insteadString where last occurrence of the given character is replaced by the provided character or the original string if its null or does not contain the characterpublic static boolean isNullOrEmpty(String data)
String is null or empty.public static boolean isNotNullOrEmpty(String data)
String is not null or empty.public static String stripStringIndicators(String data)
data - data to be used, must not be null or emptyIllegalArgumentException - if the given data is null or emptypublic static List<String> splitByDelimiters(String data, List<Character> delimiters) throws SVGException
List of Strings that contain the data, which was split by any of the given delimiters.data - the data that needs to be split.delimiters - the delimiters that indicate when the string needs to be split.List of Strings that contain the data, which was split by any of the given delimiters.SVGException - when an error occurs during the splitting.public static List<String> splitByDelimiters(String data, List<Character> delimiters, StringUtil.SplitPredicate consumePredicate) throws SVGException
List of Strings that contain the data, which was split by any of the given delimiters.data - the data that needs to be split.delimiters - the delimiters that indicate when the string needs to be split.consumePredicate - the StringUtil.SplitPredicate to use, which will determine if the currently split value will be part of the result.List of Strings that contain the data, which was split by any of the given delimiters.SVGException - when an error occurs during the splitting.Copyright © 2016 Saxonia Systems AG. All rights reserved.