I think that I am going to trim() the users input and compare it to the trim() of the name of the record in the database to see if it is a match, right?
Is anyone interpreting this requirement differently, as in actually expecting the user to type in the whole 32 chars with spaces on the end to match it exactly to the whole 32 character name in the db?
Of course, I would do the same with location.
What do you guys think?
SCJP - 1.4
SCJD - (B&S) Used 1.5 And It Runs On Solaris10
SCWCD - Thanks to HFSJ!!
because the search criterion modes in the GUI are combined with a clear "must" statement, I decided not to take any chances and to support all possible interpretations of the assignment. This resulted in three search options for the user: exact match including trailing spaces (of course a totally useless feature, but a possible, farfetched interpretation of the assignment), exact match without trailing spaces, and the "starts with" mode.
This resulted in a very, very confusing search form. I don't know if you really want to go that way, too ...
I got 24/40 for the GUI (worst GUI in 2004), full score for the rest.
I've have never did or seen a search that included trailing spaces. I think triming the trailing spaces is expected. I am also not doing case-insensitive search because it is not specified in the requirements. Even the example in the interface ("Fred" matches "Fred" and "Freddy") kind of suggest it should be case-sensitive.
Thanks to everyone for your responses. I am going to stick with trimming the spaces off the db value to match the users input.
Joined: Sep 18, 2003
Yeah, the assignment is a bit unclear, but to me, I hate the searches that are case sensitive. I have yet to see a search that is case sensitive only. So it's either case insensitive(google) or it has an option to do both(text editor's searches). Also, I doubt examiner will deduct some point from your assignment because your search is insensitive. [ March 20, 2006: Message edited by: Ed Tse ]
Strange enough but this did not pose any problem for me. I just made name and location filters the editable comboboxes. Both are filled with distinct values from name and location columns of the database. This way the user does not have to type spaces, and I do not have to guess whether the value is padded with spaces, or it really has spaces as part of the value. No trimming and everybody's happy