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]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With