Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How Do You Compare Strings In C#?
Message
From
07/01/2005 15:37:44
 
 
To
07/01/2005 12:56:19
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
00975060
Message ID:
00975248
Views:
17
Nice answer Cetin, but could you reduce it to fewer lines of code. ;-)


This sounds like the right answer to me!!!


>>I Have gone back to the ArrayList sorting problems I had a couple of weeks ago, and implemented the workaround of a sort of C# equivalent to VFP's DTOS(). However, the following line fails to compile:
>>
>>
>>if (d1 < d2) {return -1;}
>>
>>
>>with error "Operator '< ' cannot be applied to operands of type 'string' and 'string'". d1 and d2 are both strings in the format "20041104" and "20041130". So how should I be testing if d1 is less than d2?
>>
>>TIA, Kevin
>
>return d1.CompareTo(d2);
>
>Cetin
Gordon de Rouyan
DC&G Consulting
Edmonton, Alberta
Email: derouyag@shaw.ca
Previous
Reply
Map
View

Click here to load this message in the networking platform