java split string without removing

Solutions on MaxInterview for java split string without removing by the best coders in the world

showing results for - "java split string without removing"
Emilia
26 Jan 2017
1String string = "Hello-World";
2String[] split = string.Replace("-", "#-").Split("#"); 
3//# is added to the Splitpoint so we can split on #
4
5Output:
6split = [Hello, -World]