正则表达式分割数组
用正则表达式分割数组很方便:
例如:
一个字符串
"天马山","天马山","0XFF07","310117000","地址",121.141618,31.064277
的分割:
例如:
一个字符串
"天马山","天马山","0XFF07","310117000","地址",121.141618,31.064277
的分割:
string str = "\"天马山\",\"天马山\",\"0XFF07\",\"310117000\",\"地址\",121.141618,31.064277";
string[] splitstr;
str = str.TrimStart(new char[] { '"' });
splitstr = Regex.Split(str, "\",\"(.*?)\",\"(.*?)\",\"(.*?)\",\"(.*?)\",(.*?),", RegexOptions.Compiled | RegexOptions.Singleline);
string[] splitstr;
str = str.TrimStart(new char[] { '"' });
splitstr = Regex.Split(str, "\",\"(.*?)\",\"(.*?)\",\"(.*?)\",\"(.*?)\",(.*?),", RegexOptions.Compiled | RegexOptions.Singleline);