Form required string based on index

Hi,
I have string like
WHERE Ticket Update Via = Support (T3) AND Status= Closed OR Pending=Open
i want to form required string based on

  1. for column name Ticket Update Via it should replace with “Tickets”
  2. If it is AND operator we need to get text as Status= Closed
  3. If it is OR operator we ned to get text as Pending= Open,

then form it as single string,
Below is my code

string str= “WHERE Ticket Update Via = Support (T3) AND Status= Closed OR Pending=Open”

        bool strOperator= false;
        int strBegin = 0;
        string st = "WHERE";
        string strFunc = "AND";
        while (true)
        {

            int start = str.IndexOf(st) + st.Length +1 ;

            int end = str.IndexOf(strFunc, start);
            // Search AND
            break;
       }
.NET Foundation Website | Blog | Projects | Code of Conduct