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 boolean
isEmpty(String string)
Returnstrue
if given string isnull
or length is zero.static boolean
isTrimmedEmpty(String str)
This is equal tostr.trim().isEmpty()
, but avoids temporary trimmed substring allocation.static String
removeLeading(String string, String leading)
static String
removeTrailing(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 String
substringTrimmed(String str, int beginIndex)
This is equal tostr.substring( beginIndex, endIndex ).trim()
, but avoids temporary untrimmed substring allocation.static String
substringTrimmed(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)
Returnstrue
if given string isnull
or 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
-
-