加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

判断邮件的格式是否含有@:挖掘基本功

发布时间:2020-12-14 02:08:49 所属栏目:大数据 来源:网络整理
导读:判断一个字符串中是否含有@ private boolean isEmailValid(String email) { // TODO: Replace this with your own logic return email.contains( "@" );} ************************************************************************* /** * Determines if t

判断一个字符串中是否含有@

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);
}
--------------------------------------------------------------------------------

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读