aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Searching Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Searching" Watch "Searching" New topic
Author

Searching

Wickes Potgieter
Ranch Hand

Joined: Apr 05, 2002
Posts: 68
Hi,

findByCriteria method comments:
* Returns an array of record numbers that match the specified
* criteria. Field n in the database file is described by
* criteria[n]. A null value in criteria[n] matches any field
* value. A non-null value in criteria[n] matches any field
* value that begins with criteria[n]. (For example, "Fred"
* matches "Fred" or "Freddy".)

My Question:
For the search "matches any value that begins with...", should I use regular expressions or will the String Object method "startsWith" be sufficient?

Thanks,


Wickes Potgieter<br />SCJP<br />BEA Certified Specialist: Server, Integration, Portal, Tuxedo<br />BEA WebLogic Server 7 Certified Enterprise Developer<br />BEA Certified Architect<br /><a href="http://www.bea.com" target="_blank" rel="nofollow">www.bea.com</a>
Anton Golovin
Ranch Hand

Joined: Jul 02, 2004
Posts: 476
Originally posted by Wickes Potgieter:
Hi,

findByCriteria method comments:
* Returns an array of record numbers that match the specified
* criteria. Field n in the database file is described by
* criteria[n]. A null value in criteria[n] matches any field
* value. A non-null value in criteria[n] matches any field
* value that begins with criteria[n]. (For example, "Fred"
* matches "Fred" or "Freddy".)

My Question:
For the search "matches any value that begins with...", should I use regular expressions or will the String Object method "startsWith" be sufficient?

Thanks,


startsWith is the perfect method for it. In fact, I am going to use it exclusively and not check for exact matching. Exact matching will happen as a special case of using this method.

I am also going to implement criteria[n] as a mirror for the String[] array for the record. So most of the values will always be null.
[ August 15, 2004: Message edited by: Anton Golovin ]

Anton Golovin (anton.golovin@gmail.com) SCJP, SCJD, SCBCD, SCWCD, OCEJWSD, SCEA/OCMJEA [JEE certs from Sun/Oracle]
 
Don't get me started about those stupid light bulbs.
 
subject: Searching