Package org.apache.solr.common.util
Class StrUtils
- java.lang.Object
- 
- org.apache.solr.common.util.StrUtils
 
- 
 public class StrUtils extends Object 
- 
- 
Field SummaryFields Modifier and Type Field Description static char[]HEX_DIGITS
 - 
Constructor SummaryConstructors Constructor Description StrUtils()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static 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 booleanisBlank(String string)static 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 booleanparseBool(String s)how to transform a String into a boolean...static booleanparseBool(String s, boolean def)static booleanparseBoolean(CharSequence s)Return 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.static List<String>split(String s, char sep)static List<String>splitFileNames(String fileNames)Splits file names separated by comma character.static List<String>splitSmart(String s, char separator)static List<String>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.static List<String>splitSmart(String s, String separator, boolean decode)Splits a backslash escaped string on the separator.static List<String>splitWS(String s, boolean decode)static StringstringFromReader(Reader inReader)static List<String>toLower(List<String> strings)
 
- 
- 
- 
Method Detail- 
splitSmartpublic static void splitSmart(String s, char separator, List<String> lst) 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.
 - 
splitSmartpublic static List<String> splitSmart(String s, String separator, boolean decode) 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 split
- separator- the separator to split on
- decode- decode backslash escaping
- Returns:
- not null
 
 - 
splitFileNamespublic static List<String> splitFileNames(String fileNames) 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
 
 - 
joinpublic static String join(Collection<?> items, char separator) Creates a backslash escaped string, joining all the items.
 - 
parseBooleanpublic static boolean parseBoolean(CharSequence s) Return if a string starts with '1', 't', or 'T' and return false otherwise.
 - 
parseBoolpublic static boolean parseBool(String s) how to transform a String into a boolean... more flexible than Boolean.parseBoolean() to enable easier integration with html forms.
 - 
parseBoolpublic static boolean parseBool(String s, boolean def) - Returns:
- parsed boolean value (or def, if s is null or invalid)
 
 - 
partialURLEncodeValpublic static void partialURLEncodeVal(StringBuilder dest, String val) 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. 
 - 
escapeTextWithSeparatorpublic static String escapeTextWithSeparator(String item, char separator) Creates a new copy of the string with the separator backslash escaped.- See Also:
- join(java.util.Collection<?>, char)
 
 - 
appendEscapedTextToBuilderpublic static void appendEscapedTextToBuilder(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 itself
 - 
formatStringpublic static String formatString(String pattern, Object... args) Format usingMessageFormatbut with the ROOT locale
 - 
isNullOrEmptypublic static boolean isNullOrEmpty(String string) 
 - 
isNotNullOrEmptypublic static boolean isNotNullOrEmpty(String string) 
 - 
isBlankpublic static boolean isBlank(String string) 
 - 
isNotBlankpublic static boolean isNotBlank(String string) 
 - 
stringFromReaderpublic static String stringFromReader(Reader inReader) throws IOException - Throws:
- IOException
 
 
- 
 
-