该
indexOf方法还有第二种变体,它以起始索引为参数。
i = str.indexOf('x');while(i >= 0) { System.out.println(i); i = str.indexOf('x', i+1);}
该
indexOf方法还有第二种变体,它以起始索引为参数。
i = str.indexOf('x');while(i >= 0) { System.out.println(i); i = str.indexOf('x', i+1);}