Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

replaceAll

Status
Not open for further replies.

keenanbr

Programmer
Oct 3, 2001
469
IE
I'm trying to replace all occurances of '[' with '\[' without success.

myString = "abcd[xnj]";

myString.replaceAll("\\[", "\\\\[");

can't get it to succeed.

help apreciated.

Regards,
 
sorry, silly mistake it works

newString = myString.replaceAll("\\[", "\\\\[");
 
You can reuse the first String

Code:
myString = myString.replaceAll("\\[", "\\\\[");

Cheers,
Dian
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top