File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes whitespace Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "whitespace" Watch "whitespace" New topic


Yuan Du
Ranch Hand

Joined: Nov 20, 2008
Posts: 34
Hi everyone,

is there any difference between " " and "\\s"?

Thank you!

Omar Al Kababji
Ranch Hand

Joined: Jan 13, 2009
Posts: 357
yes " " is a space while "\\s" is an \s

are you talking about java ??

Omar Al Kababji - Electrical & Computer Engineer
[SCJP - 90% - Story] [SCWCD - 94% - Story] [SCBCD - 80% - Story] | My Blog
Henry Wong

Joined: Sep 28, 2004
Posts: 20380

I am going to make an assumption that this question is related to the regex engine...

In regex, a " " will match a single space. And a "\\s" will match a single whitespace. A whitespace is either a space, a tab, a vertical tab, a form feed, a carriage return, or a line feed.


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Yuan Du
Ranch Hand

Joined: Nov 20, 2008
Posts: 34
Ok Thank you , i got it.

I agree. Here's the link:
subject: whitespace
It's not a secret anymore!