2个回答
展开全部
做一个循环来判断字符串里的字符
bool includeNum = false;//包含数字
bool includeLetter = false;//包含字母
bool includeOther = false;//包含其它字符
for(int i=0; i < password.length; i++){
Char c = password.charAt(i);
if ( c >='0' && c <= '9' ){
includeNum = true;
} else if ( (c >= 'a' && c<='z') || ( c >='A'&&c<='Z') ){
includeLetter = true;
} else {
includeOther = true;
}
}
bool includeNum = false;//包含数字
bool includeLetter = false;//包含字母
bool includeOther = false;//包含其它字符
for(int i=0; i < password.length; i++){
Char c = password.charAt(i);
if ( c >='0' && c <= '9' ){
includeNum = true;
} else if ( (c >= 'a' && c<='z') || ( c >='A'&&c<='Z') ){
includeLetter = true;
} else {
includeOther = true;
}
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询