How to define the expression to check if a big char string contai ns small char string

From: Borse, Ganesh <ganesh.borse_at_credit-suisse.com>
Date: Thu, 29 Nov 2007 12:04:43 +0800


Hi,

I am trying to "Define" an expression to check whether a long char string contains another small char string. For this, I am using strstr() library function in C++.

Expression is like this:

    THaVarList * gHaVars = new THaVarList();     THaCutList * gHaCuts = new THaCutList(gHaVars);     const char* listClients="ABCD,EFGH,HIJK,NEWONE,JUNK,DONE";     const char* ordClient = "DONE";

    gHaVars->Define("listClients",listClients);
    gHaVars->Define("ordClient",ordClient);
    gHaCuts->Define("Expr","((size < 1000) && (vol < (0.001 * ADV)) && (prod == value) && strstr(listClients,ordClient) )");

Program compiles fine, but when I run this program, the Define() function call fails with an error message: Error in <THaCut::Compile>: strstr requires 2 string arguments Error in <THaCutList::Define>: expression error, cut not created: Expr ((size < 1000) && (vol < (0.001 * ADV)) && (prod == value) && strstr((listClients),(ordClient)) ) block: Default

I have given the correct number & type of input parameters to strstr, but then why is the "::Compile" still failing? How can we achieve this type of checks?

Please help.

Thanks and Regards,
Ganesh



Please access the attached hyperlink for an important electronic communications disclaimer:

http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html


Received on Thu Nov 29 2007 - 05:05:22 CET

This archive was generated by hypermail 2.2.0 : Thu Nov 29 2007 - 11:50:02 CET