Welcome to Dream.In.Code
Become a Java Expert!

Join 150,047 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 1,689 people online right now. Registration is fast and FREE... Join Now!




need help on "How To use Escape characters" in servlets

 
Reply to this topicStart new topic

need help on "How To use Escape characters" in servlets

rai000
14 Jun, 2008 - 12:51 AM
Post #1

New D.I.C Head
*

Joined: 9 Jun, 2008
Posts: 2

I want to replace backslash (\) with forwordslash(/) in my program, any help is on this is most welcomed,

my code snippest is as fallows:


//capturing the input from user form and storing it in to "tempimage" a string var,

String tempimage = request.getParameter("file");

// replacing all backslash(\) character with forword slash (/)

String image=tempimage.replaceAll("\","/" );



facing problem with compiler, i want to know that how to use escape char's in a java code ...


Thanx to all of you in advance, for reading my question and trying to help me.


regards
-rai000
User is offlineProfile CardPM
+Quote Post

mensahero
RE: Need Help On "How To Use Escape Characters" In Servlets
14 Jun, 2008 - 01:02 AM
Post #2

c0mput3rz Are Only Human
Group Icon

Joined: 26 May, 2008
Posts: 664



Thanked: 17 times
Dream Kudos: 75
My Contributions
Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Please post like this:

Thank you for helping us helping you.


Hello.. and be more specific.. more informative as possible.. blink.gif ..lmao..

This post has been edited by mensahero: 14 Jun, 2008 - 01:03 AM
User is offlineProfile CardPM
+Quote Post

1lacca
RE: Need Help On "How To Use Escape Characters" In Servlets
14 Jun, 2008 - 04:36 AM
Post #3

code.rascal
Group Icon

Joined: 11 Aug, 2005
Posts: 3,822



Thanked: 12 times
My Contributions
You must escape the backslash in Java String literals with a backslash, so the correct syntax is: String image=tempimage.replaceAll("\\","/" );


User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 10:10PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month