I have a String
String value ="Caused by:null pointer exception Caused by
: BeanCreationException.. WARNING: its just a warning..";
I would like to split String after keywords "Caused by:" and "WARNING:" so that I have output like
Any help would be much appreciated.
You can use Caused by:
or WARNING:
as your delimiters
Code:
String value ="Caused by:null pointer exception Caused by"
+ ": BeanCreationException.. WARNING: its just a warning..";
String[] sp = value.split("Caused by:|WARNING:");
Stream.of(sp).forEach(s -> System.out.println(s));
Output:
null pointer exception
BeanCreationException..
its just a warning..
Note: some part of code is in Java 8
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments