#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    London
    Posts
    13
    Rep Power
    0

    Compairing the strings


    Hi guys, i am trying to compair two strings,
    i am getting value from one table and trying to find the value in another table.
    I have written the procedure i am using but strangely it works sometime and sometime it does't.:confused:


    void __fastcall TPagesDlg:: DivEditBeforeDelete(TDataSet *DataSet)
    {
    OldGroup=DivEdit->GetTrimString("DIVNAME");//OldGroup is defined as ansistring
    }
    //---------------------------------------------------------------------------

    void __fastcall TPagesDlg:: DivEditAfterDelete(TDataSet *DataSet)
    {
    Editor->ApolloTable1->Active=true;
    Editor->ApolloTable1->GoTop();
    while( !Editor->ApolloTable1->Eof )
    {
    AnsiString value =Editor->ApolloTable1->GetTrimString("COMPANY");

    if( value== OldGroup) //This statement sometimes works, sometimes does't
    {

    Editor->ApolloTable1->Edit();
    Editor->ApolloTable1->Replace( "COMPANY" ,R_CHAR, PChar( "Undefined" ));
    Editor->ApolloTable1->Commit();
    }
    Editor->ApolloTable1->Skip(1);
    }

    }:confused:
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    68
    Rep Power
    11
    If the == operator doesn't work all of the time, try using AnsiCompare:
    Code:
    if (value.AnsiCompare(OldGroup) == 0)
    Just another way to do it, may or may not make any difference for you.

IMN logo majestic logo threadwatch logo seochat tools logo