Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

escape character

 
Arun Boraiah
Ranch Hand
Posts: 233
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am facing a problem where escape character getting printed.
String str = "first \n second";
expected output is
first
second
Assume that this string "str" is build by some other part of the program and on printing output i am getting is
first \n second
Please can anyone tell where i am going wrong.
Thanks in advance.
-arun
 
Philip Shanks
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's just a hunch, but I would double check that the program that creates the string isn't actually creating it as "\\n". In that case the backslash character itself is being escaped to give a literal backslash.
PCS
 
Biju Philip
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note sure if it's what you want, but here's the platform-independent way to do it:

-Biju
[ November 20, 2002: Message edited by: Biju Philip ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic