C# Split 根据组合字符进行拆分数组用法,如下代码:
string sql = "aaaaaaaaaa{@}bbbbbbbbbb{@}ccccccc#cccccc"; //1、单组合{@}拆分 string[] separator = new string[] { "{@}" }; //2、多组合{@}、#拆分 string[] separator1 = new string[] { "{@}", "#" }; string[] arry = sql.Split(separator, StringSplitOptions.RemoveEmptyEntries);
string[] newArry = sql.Split(new string[] { "{-<@>-}" }, StringSplitOptions.RemoveEmptyEntries);
时间: 2024-09-24 12:08:09