Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Searching

 
Wickes Potgieter
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • 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,
 
Anton Golovin
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
  • 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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic