用一个js的functionfunction haveDot(str) {
    if (str == null){
            return false;
        } else {
        var strlen = str.length;
        var i = 0;
        for (i = 0;i < strlen;i++) {
            if (str.substring(i,i+1) != ".") continue;
            return true;
        }
    }   
    return false;
}

解决方案 »

  1.   

    indexOf
    public int indexOf(String str)Returns the index within this string of the first occurrence of the specified substring. The integer returned is the smallest value k such that: 
     this.startsWith(str, k)
     is true. Parameters:
    str - any string. 
    Returns:
    if the string argument occurs as a substring within this object, then the index of the first character of the first such substring is returned; if it does not occur as a substring, -1 is returned.
      

  2.   

    public class Test{
    public static void main(String args[]){
    String temp="fdfdsf.fdfd.dfsdfsd.";
    if(temp.indexOf('.')==-1){
       System.out.println("字符串没有\".\"");
    }
    }
    }
      

  3.   

    indexOf()函数允许你判断一个字符串是否存在于一个更长的字符串中以及它所处的位置