- public class Test {
- public static void main(String[] args) {
- String s = "xXccxxxXX";
-
- System.out.println(s.indexOf("c"));
-
- System.out.println(s.indexOf("c", 3));
-
- System.out.println(s.indexOf("y"));
- System.out.println(s.lastIndexOf("x"));
- }
- }
indexOf()用法 示例如下。
原文:http://www.cnblogs.com/cyz110/p/7218129.html