2 Replies - 1745 Views - Last Post: 14 June 2008 - 05:36 AM Rate Topic: -----

#1 rai000  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 09-June 08

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

Posted 14 June 2008 - 01:51 AM

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

Is This A Good Question/Topic? 0
  • +

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

#2 mensahero  Icon User is offline

  • I Desire...
  • member icon

Reputation: 17
  • View blog
  • Posts: 678
  • Joined: 26-May 08

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

Posted 14 June 2008 - 02:02 AM

[rules]
[/rules]

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

This post has been edited by mensahero: 14 June 2008 - 02:03 AM

Was This Post Helpful? 0
  • +
  • -

#3 1lacca  Icon User is offline

  • code.rascal
  • member icon

Reputation: 44
  • View blog
  • Posts: 3,822
  • Joined: 11-August 05

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

Posted 14 June 2008 - 05:36 AM

You must escape the backslash in Java String literals with a backslash, so the correct syntax is: String image=tempimage.replaceAll("\\","/" );
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1