| | |
| | | return msg.Split('_');
|
| | | }
|
| | |
|
| | | //一维数组:来源格式如 1_2|2_3|3_1|4_3;
|
| | | //返回一维数组结构如 1|2|3|4
|
| | | public static T[] GetKeyValueKeys<T>(string msg) where T : struct
|
| | | {
|
| | | string[] segs = GetMultipleStr(msg);
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | //一维数组:来源格式如 1_2|2_3|3_1|4_3;
|
| | | //返回一维数组结构如 2|3|1|3
|
| | | public static T[] GetKeyValueValues<T>(string msg) where T : struct
|
| | | {
|
| | | string[] segs = GetMultipleStr(msg);
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | //二维数组:来源格式如 1_2_1|2_3_4|3_1_2|4_3_4
|
| | | public static T[][] GetArray2<T>(string msg) where T : struct
|
| | | {
|
| | | string[] segs = GetMultipleStr(msg);
|
| | | if (segs != null && segs.Length > 0)
|
| | | {
|
| | | T[][] array = new T[segs.Length][];
|
| | | for (int i = 0; i < segs.Length; i++)
|
| | | {
|
| | | string[] pair = GetKeyValue(segs[i]);
|
| | | if (pair.Length > 1)
|
| | | {
|
| | | array[i] = new T[pair.Length];
|
| | | for (int j = 0; j < pair.Length; j++)
|
| | | {
|
| | | array[i][j] = (T)Convert.ChangeType(pair[j], typeof(T));
|
| | | }
|
| | | }
|
| | | }
|
| | | return array;
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | //字典:来源格式如 1_2|2_3|3_1|4_3;
|
| | | public static Dictionary<T, P> GetDic<T, P>(string msg)
|
| | | {
|
| | | Dictionary<T, P> dic = null;
|