Replace All

I am using the replaceAll function.
Seems like when the string contains $, it will throw me an error.
Is that  a limitation? If yes, are there any other characters that cannot be in the string.

strTemp = strContent.replaceAll("#a#", "$10");
yan_er04Asked:
Who is Participating?
 
TimYatesConnect With a Mentor Commented:
strTemp = strContent.replaceAll( "\\#a\\#", "\\$10");

Should work...  You have to escape symbols...  And I think $ means "group" in the regex package which replace all uses...
0
 
yan_er04Author Commented:
I got the answer.
Seems like backslashes (\) and dollar signs ($) cannot be in the string.

Please reply if there are more special characters.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.