I have a set of values based on which i have split the string
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] = "!@"; //realtive Time
seperator[4] = "!+"; //
seperator[7] = "+"; //quantity
seperator[8] = "@";//price
string[] result = values.Split(seperator, StringSplitOptions.None);
For example: The input string is
*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"
For example: The input string is
*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"
The problem I am facing is : how can I relate that A is the client, AB is the company..etc etc
as the order in which the user can enter this information RANDOM…
If he doesnot enter any one of these values, it changes the result length ?
Using something like this
will give you a list of positions where the seperators start, in any order the user inputs, and then you can use substring to retrieve the values