/** * Returns whether or not this text starts with the given prefix. * @param prefix the prefix * @return {@code true} if this has the given prefix or the prefix is empty, otherwise {@code false} * @throws NullPointerException if this or the prefix is {@code null} * @since 0.9.1 */ public boolean startsWith(StringOption prefix) { if (isNull() || prefix == null || prefix.isNull()) { throw new NullPointerException(); } if (prefix.isEmpty()) { return true; } return startsWith(entity, prefix.entity); }
/** * Returns whether or not this text ends with the given suffix. * @param suffix the suffix * @return {@code true} if this has the given suffix or the suffix is empty, otherwise {@code false} * @throws NullPointerException if this or the suffix is {@code null} * @since 0.9.1 */ public boolean endsWith(StringOption suffix) { if (isNull() || suffix == null || suffix.isNull()) { throw new NullPointerException(); } if (suffix.isEmpty()) { return true; } return endsWith(entity, suffix.entity); }
/** * Returns whether or not this text contains the given substring. * @param sub the substring * @return {@code true} if this has the given substring or the substring is empty, otherwise {@code false} * @throws NullPointerException if this or the substring is {@code null} * @since 0.9.1 */ public boolean contains(StringOption sub) { if (isNull() || sub == null || sub.isNull()) { throw new NullPointerException(); } if (sub.isEmpty()) { return true; } return contains(entity, sub.entity); }