my problem is as follows:
WideCompareStr(FName,'')<>0
returns false even with FName set to ”.
WideCompareStr(trim(FName),'')<>0
returns the desired result. Why do I have to trim an empty string (”) for a comparison with another empty sting to get the correct result?
EDIT:
to clear things up:
I had the following Code to test wether a widestring-variable is the empty string or not.
function TSybVerwandlung.isEmpty: Boolean;
var
I : Integer;
begin
Result:=true;
if WideCompareStr(FName,'')<>0 then Result:=false
else if WideCompareStr(FInfo,'')<>0 then Result:=false
else
begin
//additional tests
end;
end;
This function returned true even with FName set to ” (I checked it in the debugger). After inserting trim(FName) and trim(FInfo) instead of the variables, it returned the desired result.
Did I miss something essential? The compiler I use is Borland Delphi 2006
WideCompareStr returns 0 if both strings are equal. So code:
Returns false because both strings ARE equal which is what you are expecting (I guess!).
EDIT:
I am confused now. I just checked and in following code:
Both r1 and r2 are zero which is as expected. And your second line is actually a syntax error (Trim can receive only one parameter).