how do you split a string with a string in C#

后端 未结 2 2292
借酒劲吻你
借酒劲吻你 2021-02-20 12:38

I would like to split a string into a String[] using a String as a delimiter.

String delimit = \"[break]\";
String[] tokens = myString.Split(delimit);

2条回答
  •  不知归路
    2021-02-20 12:55

    I personally prefer to use something like this, since regex has that split:

    public static string[] Split(this string input, string delimit)
    {
      return Regex.Split(input, delimit);
    }
    

提交回复
热议问题