将["ds","dswe"."cxz"] 快速转换成字符数组
现在有字符串 string str="[\"ds\",\"dswe\".\"cxz\"]"有没有快捷的办法转为 string[]
??? --------------------编程问答-------------------- 先replace然后在split --------------------编程问答--------------------
static void Main(string[] args)
{
string str = "[\"ds\",\"dswe\".\"cxz\"]";
string pattern = "[a-z]+";
var matches = Regex.Matches(str, pattern);
//结果
var result = new string[matches.Count];
for (int index = 0; index < matches.Count; index++)
{
result[index] = matches[index].Value.ToString();
}
foreach (string st in result)
{
Console.WriteLine(st);
}
Console.Read();
}
妈的,我发现我是一个正则控
补充:.NET技术 , C#