Class ParserUtils (2.0.0)

public class ParserUtils

A helper class that holds various, state-less utility functions used by the query parser.

Inheritance

java.lang.Object > ParserUtils

Static Methods

isDate(CharSequence text)

public static boolean isDate(CharSequence text)

Returns if the given string looks like a date to us. We only accept ISO 8601 dates, which have the dddd-dd-dd format.

Parameter
NameDescription
textCharSequence

text checked if it looks like a date

Returns
TypeDescription
boolean

whether this could be an ISO 8601 date

isNumber(CharSequence text)

public static boolean isNumber(CharSequence text)

Returns whether or not the given text looks like a number. The number is defined as '-'? digit* ('.' digit* ('E' ('+' | '-')? digit+)?)?

Parameter
NameDescription
textCharSequence

the text tested if it looks like a number

Returns
TypeDescription
boolean

whether or not the text represents a floating point number

trimLast(String text)

public static String trimLast(String text)

Removes the last character from the given text

Parameter
NameDescription
textString
Returns
TypeDescription
String

unescapePhraseText(CharSequence phrase)

public static String unescapePhraseText(CharSequence phrase)

Extracts phrase text by removing quotes from either end, and interpreting escape sequences.

Parameter
NameDescription
phraseCharSequence
Returns
TypeDescription
String