http://topic.csdn.net/t/20011108/12/360606.html
我自己已经解决了这个问题,现帖出来与大家共享
public String replace(String parentStr,String ch,String rep){
int i = parentStr.indexOf(ch);
StringBuffer sb = new StringBuffer();
if (i == -1)
return parentStr;
sb.append(parentStr.substring(0,i) + rep);
if (i+ch.length() < parentStr.length())
sb.append(replace(parentStr.substring(i+ch.length(),parentStr.length()),ch,rep));
return sb.toString();
}