General Information Requested Sample Priority Low Issue Description Working Issue Type Change Module english Reported By 1234 Submitted By 8433 Date submited 12/04/2016
I need to split the sting below showing list format
General Information Requested
Sample
Priority
Low
Issue Description
Working
Issue Type
Change
Module
english
Reported By
1234
Submitted By
8433
Date submited
12/04/2016
I am trying to get the result but not getting it. How can I split the string properly?
Best Answer
You can split on a regular expression. In this case, you want to split on any instance of two or more whitespace or
 
characters.Components of the above expression:
(...){N,}
- MatchN
or more consecutive matches against the expression inside the parentheses(...)
.A|B
- Match expressionA
or expressionB
.\\s
- Ends up as the expression\s
, which matches any whitespace character.
- Matches the literal string for a non-breaking space character.