diff --git a/src/seedu/addressbook/AddressBook.java b/src/seedu/addressbook/AddressBook.java index 5a158b67..9b33c6d6 100644 --- a/src/seedu/addressbook/AddressBook.java +++ b/src/seedu/addressbook/AddressBook.java @@ -210,6 +210,10 @@ public static void main(String[] args) { showWelcomeMessage(); processProgramArgs(args); loadDataFromStorage(); + runProgram(); + } + + private static void runProgram() { while (true) { String userCommand = getUserInput(); echoUserCommand(userCommand); @@ -989,12 +993,12 @@ private static String extractPhoneFromPersonString(String encoded) { // phone is last arg, target is from prefix to end of string if (indexOfPhonePrefix > indexOfEmailPrefix) { - return removePrefixSign(encoded.substring(indexOfPhonePrefix, encoded.length()).trim(), + return removePrefix(encoded.substring(indexOfPhonePrefix, encoded.length()).trim(), PERSON_DATA_PREFIX_PHONE); // phone is middle arg, target is from own prefix to next prefix } else { - return removePrefixSign( + return removePrefix( encoded.substring(indexOfPhonePrefix, indexOfEmailPrefix).trim(), PERSON_DATA_PREFIX_PHONE); } @@ -1012,12 +1016,12 @@ private static String extractEmailFromPersonString(String encoded) { // email is last arg, target is from prefix to end of string if (indexOfEmailPrefix > indexOfPhonePrefix) { - return removePrefixSign(encoded.substring(indexOfEmailPrefix, encoded.length()).trim(), + return removePrefix(encoded.substring(indexOfEmailPrefix, encoded.length()).trim(), PERSON_DATA_PREFIX_EMAIL); // email is middle arg, target is from own prefix to next prefix } else { - return removePrefixSign( + return removePrefix( encoded.substring(indexOfEmailPrefix, indexOfPhonePrefix).trim(), PERSON_DATA_PREFIX_EMAIL); } @@ -1146,12 +1150,12 @@ private static String getUsageInfoForExitCommand() { /** * Removes sign(p/, d/, etc) from parameter string * - * @param s Parameter as a string - * @param sign Parameter sign to be removed + * @param fullString Parameter as a string + * @param prefix Parameter sign to be removed * @return string without the sign */ - private static String removePrefixSign(String s, String sign) { - return s.replace(sign, ""); + private static String removePrefix(String fullString, String prefix) { + return fullString.replace(prefix, ""); } /**