I have a string like this.
PER*IP**TE**1234567890*EM*[email protected]
How can I parse the string into multiple lines like this in Java?
PER
IP
TE
//Empty String
EM
1234567890
[email protected]
You could use a regex replacement:
String input = "PER*IP**TE*1234567890*EM*[email protected]";
String output = input.replaceAll("\\*", "\n");
System.out.println(output);
This prints:
PER
IP
TE
1234567890
EM
[email protected]
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments