Solved

name equals object

Posted on 2007-11-19
6
215 Views
Last Modified: 2010-03-30
i have a image path name like
C:\Documents and Settings\User\My Documents\My Pictures\IIA\Metadata\TestingData\0060.jpg

and i store it in db (using hsqldb) during execution

but when i read the value back .. it returns it like this, with double backslash -

C:\\Documents and Settings\\User\\My Documents\\My Pictures\\IIA\\Metadata\\TestingData\\0060.jpg

is it right? or how can i access it so that it returns me path like i stored it .. and not with double backslash .. ??
0
Comment
Question by:max_dub
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 250 total points
ID: 20312898
>>is it right? or how can i access it so that it returns me path like i stored it .. and not with double backslash .. ??

It probably needs to escape it to store it. Do a replaceAll on it

path = path.replaceAll("\\\\\\\\", "\\\\");
0
 

Author Comment

by:max_dub
ID: 20313028
i did as shown below.. but replaceAll.. doesn't seem to work..

>>It probably needs to escape it to store it
is it for storing in DB u mean?
String regex = "\\";
String replacement = "\'";
		
String temp = imageIDdata.instance(0).toString();
temp = temp.replaceAll(regex, replacement);
log.info(temp);

Open in new window

0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20313069
I gave you the code above ;-)

>>is it for storing in DB u mean?

Yes
0
Technology Partners: 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!

 

Author Comment

by:max_dub
ID: 20313134
thanks :)

do u think, if the path is smaller or longer, the replaceAll expression will still work without any changes .. i cudn't decode how it is replacing \\ with \ - replaceAll("\\\\\\\\", "\\\\")
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20313228
>>do u think, if the path is smaller or longer, ...

Yes it will work irrespective of length
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20313566
:-)
0

Featured Post

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

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

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

690 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