Solved

name equals object

Posted on 2007-11-19
6
213 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Could you point what is avoiding the PHPExcel library to fill the sheet? 8 47
going to wrong jsp page 2 33
Problem to Alipay 10 43
how to debug htl and js pages 8 39
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…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

840 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