From 3d46a1ee4105a53eb5493bac5fbcfe2c864e7855 Mon Sep 17 00:00:00 2001 From: glemenneo Date: Sat, 15 Oct 2022 16:25:38 +0800 Subject: [PATCH] Change Event and Deadline seperators to include / --- docs/README.md | 12 ++++++------ src/main/java/duke/parser/Parser.java | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/README.md b/docs/README.md index 930c658ac7..ecf4cc1e75 100644 --- a/docs/README.md +++ b/docs/README.md @@ -26,16 +26,16 @@ Now you have 1 tasks in the list. Adds a Deadline task. -`deadline DESCRIPTION by YYYY-MM-DD HH:MM` +`deadline DESCRIPTION /by YYYY-MM-DD HH:MM` Example of usage: -`deadline Assignment Submission by 2022-08-17 23:59` +`deadline Assignment Submission /by 2022-08-17 23:59` Expected outcome: ``` -deadline Assignment Submission by 2022-08-17 23:59 +deadline Assignment Submission /by 2022-08-17 23:59 Got it. I've added this task: [D][ ] Assignment Submission (by: Aug 17 2022 11:59PM) Now you have 2 tasks in the list. @@ -45,16 +45,16 @@ Now you have 2 tasks in the list. Adds an Event task. -`event DESCRIPTION at YYYY-MM-DD HH:MM` +`event DESCRIPTION /at YYYY-MM-DD HH:MM` Example of usage: -`event Dinner at 2022-08-19 18:00` +`event Dinner /at 2022-08-19 18:00` Expected outcome: ``` -event Dinner at 2022-08-19 18:00 +event Dinner /at 2022-08-19 18:00 Got it. I've added this task: [E][ ] Dinner (by: Aug 19 2022 06:00PM) Now you have 3 tasks in the list. diff --git a/src/main/java/duke/parser/Parser.java b/src/main/java/duke/parser/Parser.java index f00a09dca1..ddc6befbad 100644 --- a/src/main/java/duke/parser/Parser.java +++ b/src/main/java/duke/parser/Parser.java @@ -139,17 +139,17 @@ public String parseTask(String content, TaskType type) return this.taskList.addToDo(content); case DEADLINE: - if (!content.contains(" by ")) { + if (!content.contains(" /by ")) { throw new DukeException("Formatting of deadline is incorrect."); } - contents = content.split(" by ", 2); + contents = content.split(" /by ", 2); break; case EVENT: - if (!content.contains(" at ")) { + if (!content.contains(" /at ")) { throw new DukeException("Formatting of event is incorrect."); } - contents = content.split(" at ", 2); + contents = content.split(" /at ", 2); break; default: