Package net.timewalker.ffmq4.utils
Class StringTools
- java.lang.Object
-
- net.timewalker.ffmq4.utils.StringTools
-
public class StringTools extends Object
StringTools
-
-
Constructor Summary
Constructors Constructor Description StringTools()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringasHex(byte[] data)static Stringcapitalize(String text)Capitalize the given string (null safe)static StringformatSize(long size)Format the given sizestatic intindexOf(String text, String needle, int fromIndex, boolean ignoreCase)Case-aware version of startsWith()static intindexOfIgnoreCase(String text, String needle, int fromIndex)Case-insensitive version of indexOf()static booleanisEmpty(String text)Test if the given text is null or an empty stringstatic booleanisNotEmpty(String text)Test if the given text is not null and not an empty stringstatic Stringjoin(Object[] objects, String separator)static Stringjoin(Collection<?> objects, String separator)static booleanmatches(String text, String pattern)Check if the given text matches a patternprotected static booleanmatches(String text, String pattern, boolean ignoreCase)Check if the given text matches a patternstatic booleanmatchesIgnoreCase(String text, String pattern)Check if the given text matches a patternstatic StringrightPad(String value, int size, char padChar)Right pad the given stringstatic String[]split(String str, char separatorChar)static booleanstartsWith(String text, String prefix, int offset, boolean ignoreCase)Case-aware version of startsWith()static booleanstartsWithIgnoreCase(String text, String prefix, int offset)Case-insensitive version of startsWith()
-
-
-
Method Detail
-
isEmpty
public static boolean isEmpty(String text)
Test if the given text is null or an empty string
-
isNotEmpty
public static boolean isNotEmpty(String text)
Test if the given text is not null and not an empty string
-
rightPad
public static String rightPad(String value, int size, char padChar)
Right pad the given string
-
startsWith
public static boolean startsWith(String text, String prefix, int offset, boolean ignoreCase)
Case-aware version of startsWith()
-
startsWithIgnoreCase
public static boolean startsWithIgnoreCase(String text, String prefix, int offset)
Case-insensitive version of startsWith()
-
indexOf
public static int indexOf(String text, String needle, int fromIndex, boolean ignoreCase)
Case-aware version of startsWith()
-
indexOfIgnoreCase
public static int indexOfIgnoreCase(String text, String needle, int fromIndex)
Case-insensitive version of indexOf()
-
matches
public static boolean matches(String text, String pattern)
Check if the given text matches a pattern
-
matchesIgnoreCase
public static boolean matchesIgnoreCase(String text, String pattern)
Check if the given text matches a pattern
-
matches
protected static boolean matches(String text, String pattern, boolean ignoreCase)
Check if the given text matches a pattern
-
capitalize
public static String capitalize(String text)
Capitalize the given string (null safe)- Parameters:
text- String to capitalize- Returns:
- the capitalized string
-
join
public static String join(Collection<?> objects, String separator)
-
formatSize
public static String formatSize(long size)
Format the given size
-
asHex
public static String asHex(byte[] data)
-
-