0

I am in the process of writing string split functionality and realized that split() method can take regular expression. I should split it by whitespace.

I had found following regular expression construct can do that.

\p{Space}

How do I incorporate this in my String split() method.

Dev Anand Sadasivam
  • 699
  • 7
  • 21
  • 49
  • 1
    Read documentation..`String []arr = str.split("\\p{Space}")` – rock321987 Apr 25 '16 at 05:47
  • 1
    [check](http://ideone.com/5N0T94) – rock321987 Apr 25 '16 at 05:53
  • While giving `\p` I had problem,- `Error`. So we need to precede with escape character. `str.split()` had taken up `"\\p{Space}"`. Thanks. Now I understood `regular expression constructs` can be used as is. Constructs which uses \ must be preceded with one more like \\. – Dev Anand Sadasivam Apr 25 '16 at 06:10

0 Answers0