// assume file contents are in a string buffer;
// did not try under compiler, might have some errors
String buf = ...;
String[] half = new String[]{"A",",",".",...};
String[] whole = new String[]{"\uxxxx","\uyyyy",...};for(int i = 0; i < half.length; i++) {
String oldS = half[i];
String newS = whole[i];
int prevIdx = 0; curIdx= 0;
StringBuffer result= new StringBuffer();
while((curIdx=buf.indexOf(oldS,prevIdx)) != -1){
result.append(buf.substring(prevIdx,curIdx)+newS);
preIdx = curIdx+oldS.size();
}
if(result != 0)
buf = result.toString();
}
// did not try under compiler, might have some errors
String buf = ...;
String[] half = new String[]{"A",",",".",...};
String[] whole = new String[]{"\uxxxx","\uyyyy",...};for(int i = 0; i < half.length; i++) {
String oldS = half[i];
String newS = whole[i];
int prevIdx = 0; curIdx= 0;
StringBuffer result= new StringBuffer();
while((curIdx=buf.indexOf(oldS,prevIdx)) != -1){
result.append(buf.substring(prevIdx,curIdx)+newS);
preIdx = curIdx+oldS.size();
}
if(result != 0)
buf = result.toString();
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货