strings match? | Sololearn: Learn to code for FREE!

0

strings match?

hi, just asking: how can I check if the content of two string is identical? like a password checker or something like that.(C#) thank you.

3/17/2019 6:48:38 PM

Fabrizio Piperno

6 Answers

New Answer

+3

You can use "Equals" method to check if strings are equal or not. You can see my example code. https://code.sololearn.com/c4Ty720e1N7a/?ref=app You can find more info about "Equals" method here: https://docs.microsoft.com/en-us/dotnet/api/system.string.equals?view=netframework-4.7.2 Hope it helps you.

+2

//Using conditional like following int pass1=1234; int pass2=1234; if (pass1 == pass2){ Console.WriteLine("password marched"); }else{ Console.WriteLine("Not matched"); }

+1

Fabrizio Piperno, if you need user input use for example => string mystr = Console.ReadLine();

0

ok, and if i want to get the user input?

0

Thank You❤️

0

Fabrizio Piperno , you are welcome 😉