| java.lang.Object org.josql.functions.AbstractFunctionHandler org.josql.functions.StringFunctions
StringFunctions | public class StringFunctions extends AbstractFunctionHandler (Code) | | This class holds functions that operate on strings in some way.
|
Method Summary | |
public List | grep(File f, String s, boolean ignoreCase) grep
through a file, line by line, and determine what matches there are to the nominated
String. | public List | grep(File f, String s) grep
through a file, line by line, and determine what matches there are to the nominated
String. | public double | lastIndexOf(Object o, Object i) A thinly veiled wrapper around the
String.lastIndexOf(String) method.
Both o and i are converted to Strings and then the "lastIndexoOf" method
is called on o with i as the argument. | public double | length(Object o) | public boolean | regexp(Object o, String re) Match a regular expression against the object passed in.
Parameters: o - The object to match against, toString is called on the object. Parameters: re - The regular expression to match. | public boolean | regexp(Object o, String re, String instName) Match a regular expression against the object passed in using the specified regular expression
library, pre-defined library names can be found in:
RegExpFactory .
Parameters: o - The object to match against, toString is called on the object. Parameters: re - The regular expression to match. Parameters: instName - The name of the regular expression library to use. | public List | rgrep(File f, String regexp, String instName) grep
through a file, line by line, and determine what matches there are to the nominated
regular expression using the specified regular expression implementation. | public List | rgrep(File f, String regexp) grep
through a file, line by line, and determine what matches there are to the nominated
regular expression. | public String | subStr(Object o, double f) Return a substring of the passed in object (in a string form). | public String | subStr(Object o, double f, double t) A function to return a substring of a String. | public String | trim(Object o, Object v) Given a string trim the passed in string from the front and end, set v to null
to have just whitespace trimmed. |
grep | public List grep(File f, String s, boolean ignoreCase) throws QueryExecutionException(Code) | | grep
through a file, line by line, and determine what matches there are to the nominated
String. Return a List of
FileMatch objects.
Parameters: f - The File to match against. Parameters: s - The string to match. Parameters: ignoreCase - If set to true then the case of the line and string to match are ignored. The List of FileMatch objects. |
lastIndexOf | public double lastIndexOf(Object o, Object i)(Code) | | A thinly veiled wrapper around the
String.lastIndexOf(String) method.
Both o and i are converted to Strings and then the "lastIndexoOf" method
is called on o with i as the argument.
Parameters: o - The string to search. Parameters: i - The string to match. The last index of i within o. If o is null then-1 is returned. If i is null then -1 is returned. |
regexp | public boolean regexp(Object o, String re) throws QueryExecutionException(Code) | | Match a regular expression against the object passed in.
Parameters: o - The object to match against, toString is called on the object. Parameters: re - The regular expression to match. true if the expression matches. throws: QueryExecutionException - If the match cannot be performed, or if there is no suitableregular expression library available to the RegExpFactory. |
regexp | public boolean regexp(Object o, String re, String instName) throws QueryExecutionException(Code) | | Match a regular expression against the object passed in using the specified regular expression
library, pre-defined library names can be found in:
RegExpFactory .
Parameters: o - The object to match against, toString is called on the object. Parameters: re - The regular expression to match. Parameters: instName - The name of the regular expression library to use. true if the expression matches. throws: QueryExecutionException - If the match cannot be performed, or if the instName regular expression library is not available to the RegExpFactory. |
rgrep | public List rgrep(File f, String regexp, String instName) throws QueryExecutionException(Code) | | grep
through a file, line by line, and determine what matches there are to the nominated
regular expression using the specified regular expression implementation.
Return a List of
FileMatch objects.
Parameters: f - The File to match against. Parameters: regexp - The regular expression to match against each line. This will use thedefault regular expression library. In this case the location of the match(i.e. FileMatch.getColumn) will be -1 since the regular expressionhandling does not support location matching. Also, FileMatch.getStringwill contain the regular expression used. Parameters: instName - The instance name to use. The List of FileMatch objects. throws: QueryExecutionException - If the default regular expression implementation is not available or if the file cannot be read. |
rgrep | public List rgrep(File f, String regexp) throws QueryExecutionException(Code) | | grep
through a file, line by line, and determine what matches there are to the nominated
regular expression. Return a List of
FileMatch objects.
Parameters: f - The File to match against. Parameters: regexp - The regular expression to match against each line. This will use thedefault regular expression library. In this case the location of the match(i.e. FileMatch.getColumn) will be -1 since the regular expressionhandling does not support location matching. Also, FileMatch.getStringwill contain the regular expression used. The List of FileMatch objects. throws: QueryExecutionException - If the default regular expression implementation is not available or if the file cannot be read. |
subStr | public String subStr(Object o, double f)(Code) | | Return a substring of the passed in object (in a string form). See
StringFunctions.subStr(Object,double,double) for the full details since this is just a thin-wrapper around that method with the t
parameter set to -1.
Parameters: o - The object to convert to a string and return the substring. Parameters: f - The start index. If this is set to 0 then the entire string is returned. The substring. |
subStr | public String subStr(Object o, double f, double t)(Code) | | A function to return a substring of a String. If the passed in object isn't
a string then it is converted to a string before processing.
Parameters: o - The object to convert to a string and return the substring. Parameters: f - The start index. If it's < 0 then "" is returned. If the start is out of range of the string then "" is returned. Parameters: t - The end index. If it's > f then it is reset to -1. If it's -1 thenit's ignored and the substring from the start is used. If the end is greaterthan the length of the string then it is ignored. The substring. |
trim | public String trim(Object o, Object v)(Code) | | Given a string trim the passed in string from the front and end, set v to null
to have just whitespace trimmed. Both are converted to strings first.
Parameters: o - The string to trim. Parameters: v - The string to trim from the front and end. Set to null to just trimwhitespace. The trimmed string. |
Methods inherited from org.josql.functions.AbstractFunctionHandler | public void setQuery(Query q)(Code)(Java Doc)
|
|
|