Strings

  • Thread starter Thread starter csharpula csharp
  • Start date Start date
C

csharpula csharp

Hello,
What is the best way to compare strings is it str1==str2 or
String.Compare(str1,str2)? Thank you!
 
csharpula csharp said:
What is the best way to compare strings is it str1==str2 or
String.Compare(str1,str2)? Thank you!

How about str1==str2?

Note that that will do an ordinal (culture insensitive, case sensitive)
comparison. Your actual requirements may vary from this, in which case
look at the StringComparer class and its various static properties.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top