public final class EscapeUtil extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CSV_ESCAPE
Escape character for escaping CSV type string as it can be used in a
regexp.
|
static String |
PATH_ESCAPE
Escape character used for path escaping as it can be used
in a regexp
|
Modifier and Type | Method and Description |
---|---|
static String |
combineToPath(List<String> pParts)
Combine a list of strings to a single path with proper escaping.
|
static String |
escape(String pArg,
String pEscape,
String pDelimiter)
Escape the delimiter in an argument with the given escape char.
|
static Stack<String> |
extractElementsFromPath(String pPath)
Get the path as a reverse stack with the first element of the path on top
|
static List<String> |
parsePath(String pPath)
Parse a string path and return a list of split up parts.
|
static Stack<String> |
reversePath(List<String> pathParts)
Reverse path and return as a stack.
|
static List<String> |
split(String pArg,
String pEscape,
String pDelimiter)
Split a string on a delimiter, respecting escaping with an escape char.
|
static String[] |
splitAsArray(String pArg,
String pEscape,
String pDelimiter)
Split but return an array which is never null (but might be empty)
|
public static final String PATH_ESCAPE
public static final String CSV_ESCAPE
public static String combineToPath(List<String> pParts)
pParts
- parts to combinepublic static List<String> parsePath(String pPath)
pPath
- the path to parse. Can be nullpublic static Stack<String> extractElementsFromPath(String pPath)
pPath
- path to parsepublic static Stack<String> reversePath(List<String> pathParts)
pathParts
- path to reversepublic static List<String> split(String pArg, String pEscape, String pDelimiter)
\
) is used as escape char, then the following
replacement rules apply:
\
delimiter for the delimiter as literal
\\
for backslashes
\
(everything else) is the same as (everything else).
pArg
- argument to splitpEscape
- escape pattern as it can be used in a regular expression.pDelimiter
- delimiter to usepublic static String[] splitAsArray(String pArg, String pEscape, String pDelimiter)
pArg
- argument to splitpEscape
- single character used for escapingpDelimiter
- delimiter to usepublic static String escape(String pArg, String pEscape, String pDelimiter)
pArg
- string to add escapes topEscape
- the escape character (e.g. '\')pDelimiter
- the delimiter to escape (e.g. ',')Copyright © 2017. All rights reserved.