Solved

name equals object

Posted on 2007-11-19
6
214 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
  • 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
Independent Software Vendors: 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

733 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