Answers for "java split string without removing"

0

java split string without removing

String string = "Hello-World";
String[] split = string.Replace("-", "#-").Split("#"); 
//# is added to the Splitpoint so we can split on #

Output:
split = [Hello, -World]
Posted by: Guest on July-09-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language