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.

17th Mar 2019, 6:48 PM
Fabrizio Piperno
Fabrizio Piperno - avatar
6 Réponses
+ 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.
17th Mar 2019, 7:21 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 2
//Using conditional like following int pass1=1234; int pass2=1234; if (pass1 == pass2){ Console.WriteLine("password marched"); }else{ Console.WriteLine("Not matched"); }
17th Mar 2019, 7:17 PM
Sudarshan Rai
Sudarshan Rai - avatar
+ 1
Fabrizio Piperno, if you need user input use for example => string mystr = Console.ReadLine();
17th Mar 2019, 7:27 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
0
ok, and if i want to get the user input?
17th Mar 2019, 7:18 PM
Fabrizio Piperno
Fabrizio Piperno - avatar
0
Thank You❤️
17th Mar 2019, 7:23 PM
Fabrizio Piperno
Fabrizio Piperno - avatar
0
Fabrizio Piperno , you are welcome 😉
17th Mar 2019, 7:28 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar