I need to split a string based on some character array of separators and not lose these separators in string. I.e.:
string: "Hello world!"
separators: " !"
result: ("Hello", " ", "world", "!")
Of course, i can write something that goes through that string and returns me needed result, but isn’t there something already allowing me to do this, like magically configured String.Split?
Upd: I need to solution without regexp, because it is very slow for me.
Use regular expression:
Test:
output: