| 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
|
 |
 |
|
|
subject: Adding " in String Variables...
|
|
|