Solved

name equals object

Posted on 2007-11-19
6
212 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
servlet example 11 40
spring jars download 1 27
MYSQL database problem within Coldfusion 2016 environment 12 32
How to determine if a string is a valid SHA value 7 33
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.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
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…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

773 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