Solved

Replace All

Posted on 2004-10-15
4
1,107 Views
Last Modified: 2008-01-09
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");
0
Comment
Question by:yan_er04
4 Comments
 

Author Comment

by:yan_er04
ID: 12321587
I got the answer.
Seems like backslashes (\) and dollar signs ($) cannot be in the string.

Please reply if there are more special characters.
0
 
LVL 35

Accepted Solution

by:
TimYates earned 100 total points
ID: 12322119
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

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Help with LDAp login using jsp 6 113
java cigar challenge 58 210
squirrelPlay java challenge 40 158
main method of string class 3 110
Read about the ways of improving workplace communication.
An article on effective troubleshooting
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question