String a = "2&3&4"; //表示2,3,4的位置是0
String b = "324324";
结果是:300024324
就这种样子
各位大侠写个方法接受参数是a和b,输出的结果就是拼装的结果
解决方案 »
- 急!StringReader读取字符串时长度不够的问题
- java web 实际项目中使用annotation的多吗?
- 求关注,OpenOffice将txt文件转换为doc
- 疑问:是不是无锡的兄弟都做几年就往大城市去了?
- 如何转换
- 一个困扰了很久的问题,hibernate io异常:Connection reset
- 100分求助,Tomcat启动出错
- 小弟初学JBuilder,请问URL: Unable to open location: Socket is not connected: connect是什么错误啊?
- 在线求教!!!!!!!!!!!!!!!!!!!!!!!1
- 为什么我的JBuilder5用不了EJB?
- jQuery 级联列表的问题
- 在myeclipse9.1下怎么搭建jQuery!
public static void pinChuan(String a, String b)
{
String[] str;
int len = 0;
if (a.length() > 0)
{
str = a.split("&");
Arrays.sort(str);//将数组的数字按照大小排序
for (int i = 0 ; i < str.length; i++){
len = b.length();//b的长度(一直变化)
int ind = Integer.valueOf(str[i]);
b = b.substring(0, ind-1) + "0" + b.substring(ind-1, len);
}
}
System.out.println(b);
}