src/main/java/seedu/address/logic/parser/ParserUtil.java
public static Index parseIndex(String oneBasedIndex) throws ParseException {
        String trimmedIndex = oneBasedIndex.trim();
        if (trimmedIndex.isEmpty()) {
            throw new ParseException(MESSAGE_INVALID_COMMAND_FORMAT);
        } else if (!StringUtil.isNonZeroUnsignedInteger(trimmedIndex)) {
            throw new ParseException(MESSAGE_INVALID_INDEX);
        }
        return Index.fromOneBased(Integer.parseInt(trimmedIndex));
    }
/**
     * Parses {@code oneBasedIndex} into an {@code Index} and returns it. Leading and trailing whitespaces will be
     * trimmed.
     * @throws ParseException if the specified index is invalid (not non-zero unsigned integer).
     */
Parses  oneBasedIndex into an  Index and returns it. Leading and trailing whitespaces will be
trimmed.
@throws ParseException if the specified index is invalid (not non-zero unsigned integer).
Parses oneBasedIndex into an Index and returns it . Leading and trailing whitespaces will be trimmed . @throws ParseException if the specified index is invalid ( not non - zero unsigned integer ) .
public static Index parseIndex(String oneBasedIndex) throws ParseException {
        String trimmedIndex = oneBasedIndex.trim();
        if (trimmedIndex.isEmpty()) {
            throw new ParseException(MESSAGE_INVALID_COMMAND_FORMAT);
        } else if (!StringUtil.isNonZeroUnsignedInteger(trimmedIndex)) {
            throw new ParseException(MESSAGE_INVALID_INDEX);
        }
        return Index.fromOneBased(Integer.parseInt(trimmedIndex));
    }
public static Index parseIndex ( String oneBasedIndex ) throws ParseException { String trimmedIndex = oneBasedIndex . trim ( ) ; if ( trimmedIndex . isEmpty ( ) ) { throw new ParseException ( MESSAGE_INVALID_COMMAND_FORMAT ) ; } else if ( ! StringUtil . isNonZeroUnsignedInteger ( trimmedIndex ) ) { throw new ParseException ( MESSAGE_INVALID_INDEX ) ; } return Index . fromOneBased ( Integer . parseInt ( trimmedIndex ) ) ; }
Parses {@code oneBasedIndex} into an {@code Index} and returns it.
Parses { @code oneBasedIndex } into an { @code Index } and returns it .