المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Issue with StrCmpLogicalW (and doubles) [modified]



C# Programming
06-04-2011, 02:41 PM
I'm using StrCmpLogicalW to logically compare strings. My signature is:

[DllImport("shlwapi.dll", CharSet = CharSet.Unicode)]
public static extern int StrCmpLogicalW(string x, string y);

seems like its kind of working, but I see that its giving me random results when trying to sort doubles (as strings).

1 ===> 0.883266340175621 0.842264196854649

that seems like its right, but then a second later I get:

1 ===> 0.842264196854649 0.91145355364217

that seems wrong. Obviously 0.91 is greater then 0.84. I'm thinking StrCmpLogicalW isn't liking that the 2nd string is shorter.

Can't really special case this since its in generic code that uses LINQ expression trees to get property "x" from objects and then does .ToString() on them for passing into StrCmpLogicalW.

Any ideas?



-- Modified Friday, June 3, 2011 5:05 PM