Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[W5.11][F10-2]Keith Tan #180

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/UserGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Format: `find KEYWORD [MORE_KEYWORDS]`

[NOTE]
====
The search is case sensitive, the order of the keywords does not matter, only the name is searched,
The search is not case sensitive, the order of the keywords does not matter, only the name is searched,
and persons matching at least one keyword will be returned (i.e. `OR` search).
====

Expand Down
2 changes: 1 addition & 1 deletion src/seedu/addressbook/data/person/Name.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static boolean isValidName(String test) {
* Retrieves a listing of every word in the name, in order.
*/
public List<String> getWordsInName() {
return Arrays.asList(fullName.split("\\s+"));
return Arrays.asList(fullName.toLowerCase().split("\\s+"));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider the situation where you need to retrieve the name in its original case, can you think of perhaps a better place to convert the cases?

}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/seedu/addressbook/parser/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public Command parseCommand(String userInput) {
return new ClearCommand();

case FindCommand.COMMAND_WORD:
return prepareFind(arguments);
return prepareFind(arguments.toLowerCase());

case ListCommand.COMMAND_WORD:
return new ListCommand();
Expand Down
3 changes: 2 additions & 1 deletion test/expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,9 @@
|| 0 persons listed!
|| ===================================================
|| Enter command: || [Command entered: find betsy]
|| 1. Betsy Choo Tags: [secretive]
||
|| 0 persons listed!
|| 1 persons listed!
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can try to come up with more test cases, e.g. the keywords are in upper cases etc.

|| ===================================================
|| Enter command: || [Command entered: find Betsy]
|| 1. Betsy Choo Tags: [secretive]
Expand Down