aspose file tools*
The moose likes Java in General and the fly likes Adding Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
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: 477
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: 477
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: 10523
    
    9

You need to use escape characters


[How to ask questions] [Donate a pint, save a life!] [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: 10523
    
    9

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

Joined: Mar 04, 2009
Posts: 477
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...