how to split a string by another string ?

Posted by Nikhil Vaghela on Stack Overflow See other posts from Stack Overflow or by Nikhil Vaghela
Published on 2010-04-12T12:03:02Z Indexed on 2010/04/12 12:13 UTC
Read the original article Hit count: 288

Filed under:

I have a string in following format

"TestString 1 <^> TestString 2 <^> Test String3

Which i want to split by "<^>" string.

Using following statement it gives the output i want

"TestString 1 <^> TestString 2 <^> Test String3"
 .Split("<^>".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)

But if my string contains "<" , ">" or "^" anywhere in the text then above split statement will consider that as well

Any idea how to split only for "<^>" string ?

© Stack Overflow or respective owner

Related posts about c#