This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Java in General and the fly likes Adding Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Adding " in String Variables..." Watch "Adding " in String Variables..." New topic
Author

Adding " in String Variables...

Somnath Mallick
Ranch Hand

Joined: Mar 04, 2009
Posts: 471
Hi Everyone,

I have a string which contains the character ". The problem is anywhere the " comes in the code takes it as a termination of the String and the rest of the string is ignored and hence its causing an error! For example i have to put this value in a string:

<td >CP Name</td>

The " characters are causing a problem!
Somnath Mallick
Ranch Hand

Joined: Mar 04, 2009
Posts: 471
Somehow the text after td isnt coming in the post well just wanted to let you know that after the "td" there is:
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 8435

You need to use escape characters


[Donate a pint, save a life!] [How to ask questions] [Onff-turn it on!]
Suhas Bilaye
Ranch Hand

Joined: Sep 10, 2009
Posts: 80
Hi Somnath,

From the core java side when we want " character in a string we can do it as follows using the escape character.

String s = "\"Hello\" said Nina".
System.out.println(s);

The output will be -------"Hello" said Nina


Thanks and Regards,
Suhas
http://www.xplore-java.blogspot.com/
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 8435

Suhas,
Please go easy on the color as it makes the text harder to read.
Somnath Mallick
Ranch Hand

Joined: Mar 04, 2009
Posts: 471
Thanks for the reply.
Suhas Bilaye
Ranch Hand

Joined: Sep 10, 2009
Posts: 80
Ok sure.. i will keep the color black itself
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Adding " in String Variables...
 
Similar Threads
Special characters parsing in Java
text field validation
problem laying out element of ordered list with logic iterate
JavaScript problem with IE
display in two seprate table