I have an array with seperators:
string
[] operators = { " LIKE ", " NOT LIKE ", " < ", " > ", " <= ", " >= ", " in ", " not in ", " is null ", " is not null " };I want to split a string (a query) but after the split I want to know which seperator of the array was used.
Can someone help me with this
thanks!

string.Split()
Alexander Medvedev
You could define method that returns an array of structures that contain the string/separator pairs. Put the method to some appropriate class.
here's some examples to help you to understand what im trying to say:
public struct SplittedString
{
public string value;
public string separator;
}
public SplittedString[] Split(string text, param string[] separators)
{
List<SplittedString> splittedStrings = new List<SplittedString>();
//do your separation logic here
//1. split the "text" string
//2-n. using String.IndexOf, String.Contains etc., define in which order separators was used
return splittedStrings.ToAttay();
}
mta37
I wrote an example how it can be done in another thread.
http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=121973&SiteID=1
hugo s