判断一个字符串中是否含有@
private boolean isEmailValid(String email) { //TODO: Replace this with your own logic return email.contains("@"); }*************************************************************************
/** * Determines if this {@code String} contains the sequence of characters in * the {@code CharSequence} passed. * * @param cs * the character sequence to search for. * @return {@code true} if the sequence of characters are contained in this * string, otherwise {@code false}. * @since 1.5 */ public boolean contains(CharSequence cs) { if (cs == null) { throw new NullPointerException("cs == null"); } return indexOf(cs.toString()) >= 0; }*****************************************************************************
public int indexOf(String string) { int start = 0; int subCount = string.count; int _count = count; if (subCount > 0) { if (subCount > _count) { return -1; } char[] target = string.value; int subOffset = string.offset; char firstChar = target[subOffset]; int end = subOffset + subCount; while (true) { int i = indexOf(firstChar, start); if (i == -1 || subCount + i > _count) { return -1; // handles subCount > count || start >= count } int o1 = offset + i, o2 = subOffset; char[] _value = value; while (++o2 < end && _value[++o1] == target[o2]) { // Intentionally empty } if (o2 == end) { return i; } start = i + 1; } }***************************************************************************
public int indexOf(int c, int start) { if (c > 0xffff) { return indexOfSupplementary(c, start); } return fastIndexOf(c, start); }--------------------------------------------------------------------------------