shreyas.sureja
shreyas.sureja

Reputation: 27

split method with multiple delimeters

How can I use split method of java to include delimeters like (+-/!.?:;()') and also space as one of the delimeter. My split statement looks something like this:

String[] words = myDocs[i].split("[+-/!.?:;()' ]"); 

It works fine for all the delimeters except space. Please suggest some solution.

Upvotes: 0

Views: 69

Answers (1)

Jake H.
Jake H.

Reputation: 969

Use \\s+ in place of the space.

Upvotes: 3

Related Questions