Posted By:
Adrian_Mitrica
Posted On:
Thursday, November 8, 2001 08:09 AM
You can use something like:
String theString = "whatever string";
theString = myReplace(theString, '
', "
");
where myReplace is:
private String myReplace(String inWhatToReplace, char whatToReplace, String withWhatToReplace){
int theIndex = 0;
String allReplaced;
StringBuffer repl = new StringBuffer();
theIndex = inWhatToReplace.indexOf(whatToReplace,0);
while(theIndex > 0){
repl.append(inWhatToReplace.substring(0, theIndex));
repl.append(withWhatToReplace);
inWhatToReplace = inWhatToReplace.substring(theIndex + 1);
theIndex = inWhatToReplace.indexOf(whatToReplace,0);
}
repl.append(inWhatToReplace);
allReplaced = repl.toString();
return allReplaced;
}