看看错出在哪里
我要替换str里的str2,换成str3里的词, 为什么我的程序会瘫痪呢? public String replaceSubstring()
{
StringBuilder str=new StringBuilder(line);
String str2="the";
String str3="that";
int position;
position = str.indexOf(str2);
str.replace(position,position+str2.length(), str3);
while (position !=-1)
{
position = str.indexOf(str2, position+1);
str.replace(position,position+str2.length(), str3);
}
return str.toString();
}