我具有基于一组值对我所分割字符串- C#,与分割字符串
string[] seperator = new string[9];
seperator[0] = "*"; //is the client
seperator[1] = "/"; //is the name of company
seperator[2] = "("; //name of the market
seperator[5] = ":"; //ID
seperator[6] = "?"; //orderType
seperator[3] = "[email protected]"; //realtive Time
seperator[4] = "!+"; //
seperator[7] = "+"; //quantity
seperator[8] = "@";//price
string[] result = values.Split(seperator, StringSplitOptions.None);
例如问题:输入字符串是 * A/AB(M @ 12:6? !SIMPLE + 5 + 2
OUTPUT [0]: "" [1]: "A" [2]: "AB" [3]: "M" [4]: "12" [5]: "6" [6]: "SIMPLE" [7]: "5" [8]: "2"
例如:!?!输入字符串是 * A(M @ 12 SIMPLE + 5 + 2/AB:6
OUTPUT: [0]: "" [1]: "A" [2]: "M" [3]: "12" [4]: "SIMPLE" [5]: "5" [6]: "2" [7]: "AB" [8]: "6"
我面临的问题是:我怎么能说,A是客户,AB是公司等等
作为用户可以输入这个信息的顺序RANDOM ... 如果他没有进入这些值中的任何一个,它会改变结果长度?
如果没有标记标识字段和字段顺序是随机的,我不明白你将如何去做 –
对不起,我只看到noe有标识符 –