jsp中如何判断字符串中是否有 . 在线等待!!!

guestroad 2004-04-30 09:39:14
如题
...全文
123 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
guestroad 2004-04-30
  • 打赏
  • 举报
回复
多谢!!!
flice 2004-04-30
  • 打赏
  • 举报
回复
indexOf() is enough!
qianer820109 2004-04-30
  • 打赏
  • 举报
回复
indexOf()函数允许你判断一个字符串是否存在于一个更长的字符串中以及它所处的位置
liangyongwen 2004-04-30
  • 打赏
  • 举报
回复
public class Test{
public static void main(String args[]){
String temp="fdfdsf.fdfd.dfsdfsd.";
if(temp.indexOf('.')==-1){
System.out.println("字符串没有\".\"");
}
}
}
haohuai1981 2004-04-30
  • 打赏
  • 举报
回复
string.indexOf(".",0)>=0;
qiqi01256 2004-04-30
  • 打赏
  • 举报
回复
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.
Arias 2004-04-30
  • 打赏
  • 举报
回复
用一个js的function

function 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;
}
guestroad 2004-04-30
  • 打赏
  • 举报
回复
没人回答????

81,095

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧