/**
* @(#)Paixu.java
*
* Paixu application
*
* @author
* @version 1.00 2011/9/1
*/
public class Paixu {
public static void main(String[] args){
String oldstr="I,am,,a,,,programmer";
int index = oldstr.lastIndexOf(',');
while (index >= 0) {
System.out.print(oldstr.substring(index + 1) + ',');
oldstr = oldstr.substring(0,index);
index = oldstr.lastIndexOf(',');
}
System.out.println(oldstr);
}
}
如果自己的写得话 不会想到用lastIndexOf方法 借鉴学习了
今天看到的一个犀利的带符号字符串一起反转的代码
最新推荐文章于 2021-02-04 13:48:27 发布