/// <summary> /// 截取出表格被下划线或者,号隔开的值 /// </summary> /// <param name="str"></param> /// <param name="cOne"></param> /// <param name="cTwo"></param> /// <param name="sOne"></param> /// <returns></returns> public static List <List <string> > StringSplitValue(string str, char cOne, char cTwo, string sOne) { List <List <string> > fs = new List <List <string> >(); string[] ss = str.Split(cOne); UtilsCollections.ListDoSomething(ss, (st, index) => { List <string> _s = new List <string>(); string _str = st; if (_str.Contains(sOne)) { _str = _str.Remove(_str.IndexOf(sOne), 1); } if (_str.Equals("")) { return; } string[] _ss = _str.Split(cTwo); foreach (var item in _ss) { _s.Add(item); } fs.Add(_s); }); return(fs); }
/// <summary> /// 截取出表格被下划线或者,号隔开的值 /// </summary> /// <param name="str"></param> /// <param name="cOne"></param> /// <returns></returns> public static List <string> StringSplitValue(string str, char cOne) { List <string> fs = new List <string>(); string[] ss = str.Split(cOne); UtilsCollections.ListDoSomething(ss, (st, index) => { fs.Add(st); }); return(fs); }
/// <summary> /// 截取出表格被下划线或者,号隔开的值 /// </summary> /// <param name="str"></param> /// <param name="cOne"></param> /// <param name="cTwo"></param> /// <returns></returns> public static List <string[]> StringSplitValue(string str, char cOne, char cTwo) { List <string[]> fs = new List <string[]>(); string[] ss = str.Split(cOne); //Debug.LogError(str + "-----------" + cOne + "-----------" + cTwo+"-------"+ss.Length); UtilsCollections.ListDoSomething(ss, (st, index) => { if (st.Equals("")) { return; } string[] _ss = st.Split(cTwo); List <string> _s = new List <string>(); foreach (var item in _ss) { _s.Add(item); } fs.Add(_s.ToArray()); }); return(fs); }
/// <summary> /// 截取出表格被下划线或者,号隔开的值 /// </summary> /// <param name="str"></param> /// <param name="cOne"></param> /// <param name="cTwo"></param> /// <returns></returns> public static List <List <TableValue> > StringSplitValue(string str, char cOne, char cTwo, char cThree) { List <List <TableValue> > fs = new List <List <TableValue> >(); string[] ss = str.Split(cOne); UtilsCollections.ListDoSomething(ss, (st, index) => { List <TableValue> vs = new List <TableValue>(); if (st.Equals("")) { return; } string[] _ss = st.Split(cTwo); UtilsCollections.ListDoSomething(_ss, (_st, _index) => { string[] _s = _st.Split(cThree); TableValue tableValue = new TableValue(int.Parse(_s[0]), float.Parse(_s[1]), int.Parse(_s[2])); vs.Add(tableValue); }); fs.Add(vs); }); return(fs); }