Click here to Skip to main content
15,888,803 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi. How i can split a string and keep separator. i know, that it is posible with Regex.Split, but are there other solutions?
or, how i can use Regex.Split, in case if i need to split parentheses and quotes.
so, here is the pattern i need to split string in:
[]{}'"`(),;:!?
how i can do this, or how i can split the string using regex and that pattern?
thanks.
Posted

1 solution

The easiest solution is to use a RegEx. That way you have the option of either keeping the seperator as part of the group before it, after it, or even it's own group.

With any other solution, you're going to have to write the code to do the splitting and support whatever disposition you want for the separator.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900