Package org.apache.solr.common.util
Class StrUtils
java.lang.Object
org.apache.solr.common.util.StrUtils
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidappendEscapedTextToBuilder(StringBuilder out, String item, char separator) writes chars from item to out, backslash escaping as needed based on separator -- but does not append the separator itselfstatic booleanequalsIgnoreCase(String left, String right) static StringescapeTextWithSeparator(String item, char separator) Creates a new copy of the string with the separator backslash escaped.static StringformatString(String pattern, Object... args) Format usingMessageFormatbut with the ROOT localestatic booleanstatic booleanisNotBlank(String string) static booleanisNotNullOrEmpty(String string) static booleanisNullOrEmpty(String string) static Stringjoin(Collection<?> items, char separator) Creates a backslash escaped string, joining all the items.static booleanhow to transform a String into a boolean...static booleanstatic booleanReturn if a string starts with '1', 't', or 'T' and return false otherwise.static voidpartialURLEncodeVal(StringBuilder dest, String val) URLEncodes a value, replacing only enough chars so that the URL may be unambiguously pasted back into a browser.splitFileNames(String fileNames) Splits file names separated by comma character.splitSmart(String s, char separator) splitSmart(String s, char separator, boolean trimEmpty) static voidsplitSmart(String s, char separator, List<String> lst) Split a string based on a separator, but don't split if it's inside a string.splitSmart(String s, String separator, boolean decode) Splits a backslash escaped string on the separator.static StringstringFromReader(Reader inReader)
-
Field Details
-
HEX_DIGITS
public static final char[] HEX_DIGITS
-
-
Constructor Details
-
StrUtils
public StrUtils()
-
-
Method Details
-
splitSmart
-
split
-
splitSmart
-
splitSmart
Split a string based on a separator, but don't split if it's inside a string. Assume '\' escapes the next char both inside and outside strings. -
splitSmart
Splits a backslash escaped string on the separator.Current backslash escaping supported:
\n \t \r \b \f are escaped the same as a Java String
Other characters following a backslash are produced verbatim (\c => c)- Parameters:
s- the string to splitseparator- the separator to split ondecode- decode backslash escaping- Returns:
- not null
-
splitFileNames
Splits file names separated by comma character. File names can contain comma characters escaped by backslash '\'- Parameters:
fileNames- the string containing file names- Returns:
- a list of file names with the escaping backslashes removed
-
join
Creates a backslash escaped string, joining all the items.- See Also:
-
splitWS
-
toLower
-
parseBoolean
Return if a string starts with '1', 't', or 'T' and return false otherwise. -
parseBool
how to transform a String into a boolean... more flexible than Boolean.parseBoolean() to enable easier integration with html forms. -
parseBool
- Returns:
- parsed boolean value (or def, if s is null or invalid)
-
partialURLEncodeVal
URLEncodes a value, replacing only enough chars so that the URL may be unambiguously pasted back into a browser.Characters with a numeric value less than 32 are encoded. &,=,%,+,space are encoded.
-
escapeTextWithSeparator
Creates a new copy of the string with the separator backslash escaped.- See Also:
-
appendEscapedTextToBuilder
writes chars from item to out, backslash escaping as needed based on separator -- but does not append the separator itself -
formatString
Format usingMessageFormatbut with the ROOT locale -
isNullOrEmpty
-
isNotNullOrEmpty
-
isBlank
-
isNotBlank
-
stringFromReader
- Throws:
IOException
-
equalsIgnoreCase
-