title: substring from main string using CString library functions
body: <p>Copy a substring from main string using CString library functions.</p>
  
  <pre><code>CString  FilterCriteria ="MESSAGE=2 AND READ = 2 AND Instance=\'SMS/MMS\' 
  AND Folder=\'inbox\'";
  CString  o_filter;
  </code></pre>
  
  <p>Now, i want to copy <code>Instance=\'SMS/MMS\' AND Folder=\'inbox\'</code> from <code>FilterCriteria</code> to <code>o_filteredFilterCriteria</code>. </p>
  
  <p>Expected result:</p>
  
  <pre><code>o_filter = Instance=\'SMS/MMS\' AND Folder=\'inbox\'.
  </code></pre>
  
  <p>Program:</p>
  
  <pre><code>int Pos = FilterCriteria.find(instance); 
  int First_Pos = FilterCriteria.find("'");
  string temp_str = FilterCriteria.substr(First_Pos+1);
  string temp_str =FilterCriteria.
  int Second_Pos = temp_str.find("'");  
  
  string tempInstance = FilterCriteria.substr(Pos, First_Pos+Second_Pos-
  Pos+2);
  
  temp_str = "";
  
  Pos = FilterCriteria.find(folder);// folder position
  string Fold_Str = FilterCriteria.substr(Pos);//string after the folder 
  First_Pos = Fold_Str.find("'");// first occurence of string
  temp_str = Fold_Str.substr(First_Pos+1);// string after '
  Second_Pos = temp_str.find("'");// first occurence of ' in string after '
  string tempFolder=originalFilterCriteria.substr(Pos, First_Pos+Second_Pos-
  Pos+2);
  
  if ( !tempInstance.isEmpty())
  {
      o_filter = " AND ";
      o_filter += tempInstance;
  }
  
  if (!tempFolder.isEmpty())
  {
      o_filter = " AND ";
      o_filter += tempFolder;
  }
  
  This code works for string.h library. The same code doesn't work for CString 
  functions as CString library doesn't have substr() function. 
  </code></pre>