Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Searching  RSS feed

 
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,
 
Ranch Hand
Posts: 531
1
  • 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 ]
 
Stinging nettles are edible. But I really want to see you try to eat this tiny ad:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!