|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.omnaest.utils.strings.StringUtils
public class StringUtils
Utility class for supporting the work with Strings
| Field Summary | |
|---|---|
static String |
DEFAULT_LINESEPARATOR
|
| Constructor Summary | |
|---|---|
StringUtils()
|
|
| Method Summary | ||
|---|---|---|
static int |
count(String text,
String regExSubstring)
Counts the number of matching substrings within the given text. |
|
static boolean |
endsWithStartOfOther(String text,
String textOther)
Returns true if the given text ends with the start of the other given text. |
|
static
|
formatPerArrayElement(Locale locale,
String format,
E... elements)
Similar to formatPerArrayElement(String, Object...) using String.format(Locale, String, Object...) instead. |
|
static
|
formatPerArrayElement(String format,
E... elements)
Formats an given array into a String array using String.format(String, Object...) |
|
static String |
insertString(String baseString,
String insertString,
int insertPosition,
boolean overwrite)
|
|
static int |
maximumWidth(Iterable<String> iterable)
Determines the maximum width of the given Iterable String elements |
|
static String |
percentageBar(double value,
int width)
Returns a percentage bar looking like: [====o ] |
|
static String |
repeat(CharSequence token,
int repeats)
Repeats the given CharSequence |
|
static String |
setFixedWitdth(String value,
int width)
|
|
static String[] |
split(String text,
char delimiter,
char quote)
Simple form of the StrTokenizer |
|
static String[] |
splitByInterval(String text,
int interval)
Splits a given String text by an interval. |
|
static String |
stringJoin(String[] strings,
String delimiter)
|
|
static Iterable<String> |
tokenizerPatternBased(CharSequence charSequence,
String regexDelimiter)
Returns a new Iterable instance for the given CharSequence which uses the given regular expression delimiter
to produce tokens. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String DEFAULT_LINESEPARATOR
| Constructor Detail |
|---|
public StringUtils()
| Method Detail |
|---|
public static boolean endsWithStartOfOther(String text,
String textOther)
text - textOther -
public static String stringJoin(String[] strings,
String delimiter)
strings - delimiter -
public static String insertString(String baseString,
String insertString,
int insertPosition,
boolean overwrite)
public static String setFixedWitdth(String value,
int width)
value - width -
public static int maximumWidth(Iterable<String> iterable)
Iterable String elements
iterable -
public static String repeat(CharSequence token,
int repeats)
CharSequence
token - repeats -
public static String percentageBar(double value,
int width)
value - width -
public static String[] splitByInterval(String text,
int interval)
String text by an interval.
text - interval -
public static String[] split(String text,
char delimiter,
char quote)
StrTokenizer
text - delimiter - quote -
public static int count(String text,
String regExSubstring)
Pattern.quote(String) if a substring contains special characters.
count("ab ab","ab") = 2
count("abab","ab") = 2
count("ababab","abab") = 1
count("ababab ababab","abab") = 2
count("aba bab","abab") = 0
text - regExSubstring -
public static Iterable<String> tokenizerPatternBased(CharSequence charSequence,
String regexDelimiter)
Iterable instance for the given CharSequence which uses the given regular expression delimiter
to produce tokens. CharSequence or the given delimiter is null this returns null. StringUtils.tokenizerPatternBased( "a;b", ";" ) => "a","b" StringUtils.tokenizerPatternBased( null, ";" ) => null StringUtils.tokenizerPatternBased( "a;b", null ) => null
charSequence - regexDelimiter -
public static <E> String[] formatPerArrayElement(String format,
E... elements)
String array using String.format(String, Object...)
format - elements - has to be a non primitive array
public static <E> String[] formatPerArrayElement(Locale locale,
String format,
E... elements)
formatPerArrayElement(String, Object...) using String.format(Locale, String, Object...) instead.
locale - Localeformat - elements -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||