• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Searching

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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,
 
Ranch Hand
Posts: 531
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic