public class StringParser extends Object
This package methods read JEXL string literals and handle escaping through the 'backslash' (ie: \) character. Escaping is used to neutralize string delimiters (the single and double quotes) and read Unicode hexadecimal encoded characters.
The only escapable characters are the single and double quotes - ''' and '"' -, a Unicode sequence starting with 'u' followed by 4 hexadecimals and the backslash character - '\' - itself.
A sequence where '\' occurs before any non-escapable character or sequence has no effect, the sequence output being the same as the input.
Constructor and Description |
---|
StringParser()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
static String |
buildString(CharSequence str,
boolean eatsep)
Builds a string, handles escaping through '\' syntax.
|
static String |
escapeString(String str,
char delim)
Escapes a String representation, expand non-ASCII characters as Unicode escape sequence.
|
static int |
readString(StringBuilder strb,
CharSequence str,
int index,
char sep)
Read the remainder of a string till a given separator,
handles escaping through '\' syntax.
|
public static String buildString(CharSequence str, boolean eatsep)
str
- the string to build fromeatsep
- whether the separator, the first character, should be consideredpublic static int readString(StringBuilder strb, CharSequence str, int index, char sep)
strb
- the destination buffer to copy characters intostr
- the originindex
- the offset into the originsep
- the separator, single or double quote, marking end of stringCopyright © 2016 Internet2. All rights reserved.