有个String的方法
String par;
String son;
……
int i = par.indexOf(str)就是str在par中的位置,如果没有匹配的,则i值为-1
String par;
String son;
……
int i = par.indexOf(str)就是str在par中的位置,如果没有匹配的,则i值为-1
解决方案 »
- 代码怎么回事,帮忙看看
- 动态SQL与预编译的区别?
- 初级问题,关于session
- struts 中加入fckeditor的问题
- JSTL访问SQL2000数据库问题
- 跪求一java web开发qq群,交流经验
- 朝java web方向发展学些什么?
- 使用native2ascii.exe查Unicode编码问题
- 我要让页面的内容居中,怎么实现不了?
- RESTful Spring接口报错-No bean named 'cxf' is defined
- 关于<setProperty >语句的问题,很简单,毕业设计急用,谢谢大家了!
- 欢迎讨论:JSP+SQL Server+Apache建立一个Web服务器有什么值得注意的问题?(之二)
Returns the index within this string of the first occurrence of the specified substring.for example:
String s1="http://www.csdn.net/";
String s2="csdn";
int i=s1.indexOf(s2);
System.out.println("index:"+i);
int i = par.indexOf(son);
i就是son字串在par字串中第一个匹配的位置