This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Adding " in String Variables...

 
Somnath Mallick
Ranch Hand
Posts: 482
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 482
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
 
Suhas Bilaye
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Maneesh Godbole
Saloon Keeper
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suhas,
Please go easy on the color as it makes the text harder to read.
 
Somnath Mallick
Ranch Hand
Posts: 482
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply.
 
Suhas Bilaye
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok sure.. i will keep the color black itself
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic