Possible Duplicate:
C# split string but keep split chars / separators
Is there a simple way to do a .Net string split() function that will leave the original split characters in the results?
Such that:
"some text {that|or} another".Split('{','|','}');
would result in an array with:
[0] = "some text "
[1] = "{"
[2] = "that"
[3] = "|"
...
Preferably without a regex.
check out this post
the first answer with a RegEx solution, the second for a non-regex solution...
In Concept...
you can probably roll your own using String.IndexOf Method (String, Int32) to find all of your initial separator characters, and merge those in with the results of
String.Split