File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Adding special characters to a String Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Adding special characters to a String " Watch "Adding special characters to a String " New topic
Author

Adding special characters to a String

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Hi

I want to construct a StringBuffer in this way

{
"jobs": {


I have tried with this which produces

"jobs":{

please help me to add { also ??



Save India From Corruption - Anna Hazare.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14435
    
  23

Just add it at the front of the string. There is nothing "special" about the { character inside strings. If you want a newline character after the {, then use \n:


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
prem pillai
Ranch Hand

Joined: Nov 02, 2007
Posts: 87

Jesper de Jong wrote:


I would suggest the below code instead ...
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Thank you very much
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Adding special characters to a String