src/main/java/seedu/insurancepal/logic/parser/ParserUtil.java
/**
     * Parses a {@code String insurance} into an {@code Insurance}.
     * Leading and trailing whitespaces will be trimmed.
     *
     * @throws ParseException if the given {@code insurance} is invalid.
     */
Parses a  String insurance into an  Insurance.
Leading and trailing whitespaces will be trimmed.

@throws ParseException if the given  insurance is invalid.
Parses a String insurance into an Insurance . Leading and trailing whitespaces will be trimmed . @throws ParseException if the given insurance is invalid .
public static Insurance parseInsurance(String insurance) throws ParseException {
        requireNonNull(insurance);
        String trimmedInsurance = insurance.trim();
        String[] insuranceTokens = trimmedInsurance.split("\\s+", 2);
        String insuranceType = insuranceTokens.length > 0 ? insuranceTokens[0] : "";
        String insuranceName = insuranceTokens.length > 1 ? insuranceTokens[1] : "";
        try {
            return Insurance.of(insuranceType, insuranceName);
        } catch (IllegalValueException exception) {
            throw new ParseException(exception.getMessage());
        }
    }
public static Insurance parseInsurance ( String insurance ) throws ParseException { requireNonNull ( insurance ) ; String trimmedInsurance = insurance . trim ( ) ; String [ ] insuranceTokens = trimmedInsurance . split ( "\\s+" , 2 ) ; String insuranceType = insuranceTokens . length > 0 ? insuranceTokens [ 0 ] : "" ; String insuranceName = insuranceTokens . length > 1 ? insuranceTokens [ 1 ] : "" ; try { return Insurance . of ( insuranceType , insuranceName ) ; } catch ( IllegalValueException exception ) { throw new ParseException ( exception . getMessage ( ) ) ; } }
Parses a {@code String insurance} into an {@code Insurance}.
Parses a { @code String insurance } into an { @code Insurance } .