Package com.formdev.flatlaf.util
Class StringUtils
- java.lang.Object
-
- com.formdev.flatlaf.util.StringUtils
-
public class StringUtils extends Object
Utility methods for strings.
-
-
Constructor Summary
Constructors Constructor Description StringUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanisEmpty(String string)Returnstrueif given string isnullor length is zero.static booleanisTrimmedEmpty(String str)This is equal tostr.trim().isEmpty(), but avoids temporary trimmed substring allocation.static StringremoveLeading(String string, String leading)static StringremoveTrailing(String string, String trailing)static List<String>split(String str, char delim)static List<String>split(String str, char delim, boolean trim, boolean excludeEmpty)Splits a string at the specified delimiter.static StringsubstringTrimmed(String str, int beginIndex)This is equal tostr.substring( beginIndex, endIndex ).trim(), but avoids temporary untrimmed substring allocation.static StringsubstringTrimmed(String str, int beginIndex, int endIndex)This is equal tostr.substring( beginIndex ).trim(), but avoids temporary untrimmed substring allocation.
-
-
-
Method Detail
-
isEmpty
public static boolean isEmpty(String string)
Returnstrueif given string isnullor length is zero.
-
split
public static List<String> split(String str, char delim, boolean trim, boolean excludeEmpty)
Splits a string at the specified delimiter. If trimming is enabled, then leading and trailing whitespace characters are removed. If excludeEmpty istrue, then only non-empty strings are returned.- Since:
- 2
-
substringTrimmed
public static String substringTrimmed(String str, int beginIndex)
This is equal tostr.substring( beginIndex, endIndex ).trim(), but avoids temporary untrimmed substring allocation. If the trimmed string is empty, a shared empty string is returned.- Since:
- 2
-
substringTrimmed
public static String substringTrimmed(String str, int beginIndex, int endIndex)
This is equal tostr.substring( beginIndex ).trim(), but avoids temporary untrimmed substring allocation. If the trimmed string is empty, a shared empty string is returned.- Since:
- 2
-
isTrimmedEmpty
public static boolean isTrimmedEmpty(String str)
This is equal tostr.trim().isEmpty(), but avoids temporary trimmed substring allocation.- Since:
- 2
-
-