C#: String split returning list of strings AND list of delimiters?

Posted by Andrew White on Stack Overflow See other posts from Stack Overflow or by Andrew White
Published on 2010-06-13T11:32:50Z Indexed on 2010/06/13 11:42 UTC
Read the original article Hit count: 205

Filed under:
|
|

Hi,

Is there any inbuilt way in C# to split a text into an array of words and delimiters? What I want is:

text = "word1 + word2 - word3";
string[] words = text.Split(new char[] { '+', '-'});
//Need list '+', '-' here?

Any ideas? Obviously I can just process the text by hand... :)

© Stack Overflow or respective owner

Related posts about c#

Related posts about string-manipulation