Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
plz i want to now how comper between two sting on c#
Posted

1 solution

You should buy a C# book or read some online tutorials. You can't learn C# at this level via forum posts.

It depends what you want to compare. If you want to compare if they are both the same, then the == operator will do it

if (string1 == string2)

If you want to do a case insensitive compare, then make them both lower case:

if (string1.ToLower() == string2.ToLower())

There's many other ways to compare strings ( such as Contains ), but really, again, at this level, you need to work through a book if you want to learn C#.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900