public class WikiScannerUtil extends Object
Constructor and Description |
---|
WikiScannerUtil() |
Modifier and Type | Method and Description |
---|---|
static String |
extractSubstring(String str,
String open,
String close)
Extracts and returns a substring of the given string starting from the
given open sequence and finishing by the specified close sequence.
|
static String |
extractSubstring(String str,
String open,
String close,
char escape)
Extracts and returns a substring of the given string starting from the
given open sequence and finishing by the specified close sequence.
|
static String |
extractSubstring(String str,
String open,
String close,
char escape,
boolean cleanEscape)
Extracts and returns a substring of the given string starting from the
given open sequence and finishing by the specified close sequence.
|
static int |
getNextSequence(char[] array,
int pos,
char[] delimiter,
StringBuffer buf)
This method copies to the given buffer all characters from the specified
position of the character array to the next delimiter position.
|
static boolean |
matchesSequence(char[] array,
int arrayPos,
char[] sequence)
Indicate if the specified sequence starts from the given position in the
character array.
|
static int |
skipSequence(char[] array,
int arrayPos,
char[] sequence)
Skips the specified sequence if it starts from the given position in the
character array.
|
static int |
splitToPairs(String str,
List<WikiParameter> list)
Splits the given string into a set of key-value pairs; all extracted
values will be added to the given list
|
static int |
splitToPairs(String str,
List<WikiParameter> list,
char escapeChar) |
static int |
splitToPairs(String str,
List<WikiParameter> list,
String delimiter)
Splits the given string into a set of key-value pairs; all extracted
values will be added to the given list
|
static int |
splitToPairs(String str,
List<WikiParameter> list,
String delimiter,
String end) |
static int |
splitToPairs(String str,
List<WikiParameter> list,
String delimiter,
String end,
char escapeChar)
Splits the given string into a set of key-value pairs; all extracted
values will be added to the given list
|
static String |
unescape(String str)
Unescapes the given string and returns the result.
|
static String |
unescape(String str,
char escape)
Unescapes the given string and returns the result.
|
public static String extractSubstring(String str, String open, String close)
str
- from this string the substring framed by the specified open
and close sequence will be returnedopen
- the start substring sequenceclose
- the closing substring sequencepublic static String extractSubstring(String str, String open, String close, char escape)
str
- from this string the substring framed by the specified open
and close sequence will be returnedopen
- the start substring sequenceclose
- the closing substring sequenceescape
- the escape symbolpublic static String extractSubstring(String str, String open, String close, char escape, boolean cleanEscape)
str
- from this string the substring framed by the specified open
and close sequence will be returnedopen
- the start substring sequenceclose
- the closing substring sequenceescape
- the escape symbolcleanEscape
- indicate if the escaping char has to be removed.
Useful when the substring use the same escaping that the string.public static int getNextSequence(char[] array, int pos, char[] delimiter, StringBuffer buf)
array
- the array of character used as a source of charspos
- the start position in the arraydelimiter
- the delimiter; this method copies all character from the
current position to the first delimiter sequencebuf
- the buffer where the content should be appendedpublic static boolean matchesSequence(char[] array, int arrayPos, char[] sequence)
array
- the array of charactersarrayPos
- the position of the first character in the array;
starting from this position the sequence should be skippedsequence
- the sequence of characters to matchpublic static int skipSequence(char[] array, int arrayPos, char[] sequence)
array
- the array of charactersarrayPos
- the position of the first character in the array;
starting from this position the sequence should be skippedsequence
- the sequence of characters to skippublic static int splitToPairs(String str, List<WikiParameter> list)
str
- the string to splitlist
- to this list all extracted values will be addedpublic static int splitToPairs(String str, List<WikiParameter> list, char escapeChar)
public static int splitToPairs(String str, List<WikiParameter> list, String delimiter)
str
- the string to splitlist
- to this list all extracted values will be addeddelimiter
- a delimiter for individual key/value pairspublic static int splitToPairs(String str, List<WikiParameter> list, String delimiter, String end)
public static int splitToPairs(String str, List<WikiParameter> list, String delimiter, String end, char escapeChar)
str
- the string to splitlist
- to this list all extracted values will be addeddelimiter
- a delimiter for individual key/value pairsend
- the ending sequence, if null it's not taken into accountescapeChar
- the escaping characterpublic static String unescape(String str)
DEFAULT_ESCAPECHAR
).str
- the string to unescapeCopyright © 2004–2021 XWiki. All rights reserved.