How to split string that delimiters remain in the end of result?
问题 I have several delimiters. For example {del1, del2, del3 }. Suppose I have text : Text1 del1 text2 del2 text3 del3 I want to split string in such way: Text1 del1 text2 del2 text3 del3 I need to get array of strings, when every element of array is texti deli. How can I do this in C# ? 回答1: String.Split allows multiple split-delimeters. I don't know if that fits your question though. Example : String text = "Test;Test1:Test2#Test3"; var split = text.Split(';', ':', '#'); //split contains an