用String的:
int indexOf(int ch)
Returns the index within this string of the first occurrence of the specified character.
int indexOf(int ch)
Returns the index within this string of the first occurrence of the specified character.
解决方案 »
- struts token 重复提交
- struts2中对某个辅助类的静态成员变量进行控制是否要加同步控制呀?向java高手求教
- 想做个前台插入信息,后台会自动提示的功能
- "ABCD|EFG|HIJK|...", 象这样以某个特定字符("|")间隔的字符串, java里有没有现成的函数来拆分?
- 关于上传组件jspsmartupload 的小问题!
- jsp如何遍历session?
- 如何在页面中制作弹出菜单
- 保留原来框架页面,winopen打开的一个页面,然后发现session超时(需要重登陆),希望在原来的框架页面里打开登陆页面,关闭弹出窗口
- 条件语句出错?无法进行判断,大侠帮忙!
- 有关jsp加载时进度的问题?
- 问一个html的问题,请高手指教呀
- 请问乱码问题
System.out.println(s.index("o"));
int i = 0;
i = str.lastIndexOf("s"); //i就是在字符串中最后出现的位置
{
public static void main(String[] args)
{
String s="abcd";
int n=s.indexOf('d');
System.out.println(n);
}
}注意:输出位置,第一字符为0!