Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Java Language
Expertise: Beginner
Aug 8, 2000

Escaped Characters

Question:
When defining a string, is there a way to include a carriage return in the text?

Answer:
Yes. A carriage return is represented by the special escaped character \r. However, make sure that if you really want a line separator, and not a carriage return, that you query the line.separator property using System.getProperty(). Java supports the following escaped characters:

  • \b backslash
  • \t horizontal tab
  • \n linefeed
  • \f form feed
  • \r carriage return
  • \" double quote
  • \' single quote
  • \\ backslash
Octal values and Unicode escape values are also supported.
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date