3 回答

Davidham3
TA贡献8条经验 获得超0个赞
public static void main(String[] args){ String a = "hahahaha"; int k = 0;//用来判断是否有. for(int i = 0; i < a.length(); i++){ if(a.charAt(i) == '.'){ k = 1; break; } } if(k == 1){ System.out.println("有."); }else{ System.out.println("没有."); } }

_潇潇暮雨
TA贡献646条经验 获得超225个赞
使用正则啊.以js为例:
'use strict' let containsPoint = (input) => /\./.test(input) console.log(containsPoint('hefdsfsd.dsfdsfds')) // true console.log(containsPoint('hefdsfsddsfdsfds')) // false
添加回答
举报
0/150
提交
取消