On Thu, Feb 13, 2003 at 02:49:49AM +0100, Iv?n Montes wrote: > Hi, > > Maybe it's how it's supposed to be but if use : > > compareStr( 'hello', 'hello-bye' ) > > I get 0, so they are equal. > > If one string is bigger than the other they should be different, isn't it? > > Otherways what can I use to check if two ansistrings are different? > > TIA, Ivan
I think this may be a bug in the compareStr function of sysUtils. I have tested the compareStr of sysUtils, and the compStr of the Strings unit. The Strings unit seems to do the test ok, and the result: 'hello' < 'hello-byte'. cheers James program compare; (* uses sysUtils; *) uses Strings; var (* str1: String; str2: String; *) str1: pChar; str2: pChar; r: Integer; begin str1 := 'hello'; str2 := 'hello-bye'; writeLn('str1 = ', str1); writeLn('str2 = ', str2); writeLn; r := strComp(str1, str2); if r < 0 then begin writeLn('str1 < str2'); end else if r = 0 then begin writeLn('str1 = str2'); end else begin writeLn('str1 > str2'); end; end. > _______________________________________________ > fpc-pascal maillist - [EMAIL PROTECTED] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal _______________________________________________ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal