0

Let's say i have:

string text = "Ivan - George ; Josh , Mike John";

And i want to split it by

" - ", " ; " , " ".

Normally when I want to split a text by 1 element I would use:

List<string> names = text.Split(" - ").ToList();

But now I encountered a problem where i need to split a text by multiple characters and I don't know how to do it...

1 Answers1

0
List<string> names = text.Split(
    new []{" - ", " ; ", " "}, 
    StringSplitOptions.None).ToList();
Yuriy Faktorovich
  • 67,283
  • 14
  • 105
  • 142