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 Piperno6 Answers
New AnswerYou 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.
//Using conditional like following int pass1=1234; int pass2=1234; if (pass1 == pass2){ Console.WriteLine("password marched"); }else{ Console.WriteLine("Not matched"); }
Fabrizio Piperno, if you need user input use for example => string mystr = Console.ReadLine();
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message