A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Take Control of Upgrading to Yosemite
Take Control of Automating Your Mac
this week in the
simple string replace question
Joined: Jan 09, 2010
Feb 11, 2011 11:16:11
, how do I replace all occurrences of "\" by "\\" ?.
Thanks in advance.
Joined: Oct 27, 2005
Feb 11, 2011 11:24:13
By using String.replace(CharSequence, CharSequence) - String implements CharSequence so you can use String literals. Unlike String.replaceAll, this method doesn't take regular expressions so you need a lot less escaping.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions
How To Answer Questions
I agree. Here's the link:
subject: simple string replace question
replacing a regex wild card
String method "replace(char, char)"
Simple Eclipse Question
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014