|
Method
|
Description
|
Standard
|
|
startsWith(String)
|
Returns if the string starts with the passed string
|
|
|
endsWith(String)
|
Returns if the string ends with the passed string
|
|
|
indexOf(String)
|
Returns the first position of the passed string
|
|
|
indexOf(String,int)
|
Returns the position of the passed string, after the passed position
|
|
|
substring(int)
|
Returns the substring starting from the passed position
|
|
|
substring(int,int)
|
Returns the substring between the passed positions
|
|
|
toLowerCase()
|
Returns the string in lowercase
|
|
|
toUpperCase()
|
Retuns the string in UPPERCASE
|
|
|
matches(String pattern)
|
Returns whether string matches the passed expression. The pattern argument follows the rules of
java.lang.String.matches method.
|
|
|
charAt(int)
|
Returns the character at the passed position
|
|
|
startsWith(String, int)
|
Returns if the string starts with the passed string, from the passed position
|
|
|
length()
|
Returns the length of the string
|
|
|
trim()
|
Returns a trimmed version of the string
|
|
|
equals(String)
|
Returns if the strings are equal
|
|
|
equalsIgnoreCase(String)
|
Returns if the strings are equal ignoring case
|
|
|
replaceAll(String, String)
|
Returns the string with all instances of
str1
replaced by
str2
|
|
Here's an example using a Product class, looking for objects which their abreviation is the
beginning of a trade name. The trade name is provided as parameter.
Declarative JDOQL :
Query query = pm.newQuery(mydomain.Product.class);
query.setFilter(":tradeName.startsWith(this.abbreviation)");
List results = (List)query.execute("Workbook Advanced");
Single-String JDOQL :
Query query = pm.newQuery(
"SELECT FROM mydomain.Product " +
"WHERE :tradeName.startsWith(this.abbreviation)");
List results = (List)query.execute("Workbook Advanced");