这是第二种将字符串反转的程序
public String resverse1(String str,int startIndex,int endIndex) {
if(str!=null) {
String resverse=str.substring(0,startIndex);
for(int i=endIndex;i>startIndex;i–) {
resverse+=str.charAt(i);
}
resverse +=str.substring(endIndex+1);
return resverse;
}
return null;
}
字符串反转2
最新推荐文章于 2022-06-23 17:05:12 发布