Package org.epics.util.text
Class StringUtil
- java.lang.Object
-
- org.epics.util.text.StringUtil
-
public class StringUtil extends Object
A set of utilities to parse strings. It contains- Author:
- carcassi
-
-
Field Summary
Fields Modifier and Type Field Description static StringDOUBLE_REGEXThe pattern of a double value.static StringDOUBLE_REGEX_WITH_NANThe pattern of a double value.static StringQUOTED_STRING_REGEXThe pattern of a string, including double quotes.static StringSINGLEQUOTED_STRING_REGEXThe pattern of a string using single quotes.static StringSTRING_ESCAPE_SEQUENCE_REGEXThe pattern of a string fragment with escape sequences.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<Object>parseCSVLine(String line, String separatorRegex)Parses a line of text representing comma separated values and returns the values themselves.static StringunescapeString(String escapedString)Takes an escaped string and returns the unescaped versionstatic Stringunquote(String quotedString)Takes a single quoted or double quoted String and returns the unquoted and unescaped version of the string.
-
-
-
Field Detail
-
STRING_ESCAPE_SEQUENCE_REGEX
public static final String STRING_ESCAPE_SEQUENCE_REGEX
The pattern of a string fragment with escape sequences.- See Also:
- Constant Field Values
-
QUOTED_STRING_REGEX
public static final String QUOTED_STRING_REGEX
The pattern of a string, including double quotes.- See Also:
- Constant Field Values
-
SINGLEQUOTED_STRING_REGEX
public static final String SINGLEQUOTED_STRING_REGEX
The pattern of a string using single quotes.- See Also:
- Constant Field Values
-
DOUBLE_REGEX
public static final String DOUBLE_REGEX
The pattern of a double value.- See Also:
- Constant Field Values
-
DOUBLE_REGEX_WITH_NAN
public static final String DOUBLE_REGEX_WITH_NAN
The pattern of a double value.- See Also:
- Constant Field Values
-
-
Method Detail
-
unquote
public static String unquote(String quotedString)
Takes a single quoted or double quoted String and returns the unquoted and unescaped version of the string.- Parameters:
quotedString- the original string- Returns:
- the unquoted string
-
unescapeString
public static String unescapeString(String escapedString)
Takes an escaped string and returns the unescaped version- Parameters:
escapedString- the original string- Returns:
- the unescaped string
-
parseCSVLine
public static List<Object> parseCSVLine(String line, String separatorRegex)
Parses a line of text representing comma separated values and returns the values themselves.- Parameters:
line- the line to parseseparatorRegex- the regular expression for the separator- Returns:
- the list of values
-
-