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

Questions on find find(String[] criteria)

 
lambertlee Li
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my assignment, i got instruction on find()method "A non-null value in criteria[n] matches any field value that begins with criteria[n]. (For example, "Fred" matches "Fred" or "Freddy".)".

1) Does this means if user input search criteria of "Fred", I could
just make use of String.startsWith() to search and return the result. But if only make use of
String.startsWith(), the search functionality is quite limited. If I only provide this, will I lose points because of
this? Because it does not perform more complex search, such as wild card search"*Fred*". What do u guys think? Suggestion please.


2)Do we really need the regular expression
to perform search? For example, if user input a search string of "a*b", we could use regexp to perform search.
But that means we have to inforced user to know regexp and to send regexp to backend. Is it a good way?
 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) yes, that's what it means. No need to do more.
2) My server supports it as a demonstration of how the search mechanism I created is pluggable, but it's not called from the client.

complex searching isn't a requirement (at least for my assignment).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic