Solved

Replace All

Posted on 2004-10-15
4
1,109 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
maven project in eclipse 11 60
instanceof  operator in java 26 102
Books that can get me started on JAVA 2 116
Suggestion on WebSite Template Sites 6 116
After-hours service is a fact of life for most MSPs. While not the most pleasant aspect of the job, there are ways to make after-hours servicing a more profitable and organized enterprise.
This article summaries thoughts and ideas from two years of sustained use. It provides good reasoning to make the jump to Windows 10.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

685 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