19

What is difference of below escape sequences for white space?

\t, \n, \x0B, \f and \r.

Jens Schauder
  • 77,657
  • 34
  • 181
  • 348
Praveen
  • 90,477
  • 74
  • 177
  • 219

3 Answers3

45
  • \t      The tab character (\u0009)
  • \n      The newline (line feed) character (\u000A)
  • \r      The carriage-return character (\u000D)
  • \f      The form-feed character (\u000C)
  • \x0B  The vertical tabulation (VT) character
Sk8erPeter
  • 6,899
  • 9
  • 48
  • 67
b.roth
  • 9,421
  • 8
  • 37
  • 50
8
\t - Horizontal tab
\n - New line
\x0B - Vertical tab
\f - form feed
\r - carriage return
codaddict
  • 445,704
  • 82
  • 492
  • 529
6

Looks like you left out the operators, but I'm interpreting you to want to know how various Java APIs handle those characters.

The Java handling of these characters is determined by their Unicode character properties. See the Unicode spec to see what properties they have, and thus what the different functions in Character return for them.

www.unicode.org will tell you all you ever wanted to know about Unicode properties.

bmargulies
  • 97,814
  • 39
  • 186
  • 310