Compare strings using StringComparison enumeration
using System;
class MainClass {
public static void Main() {
string pswd = "asdf";
string str = "fda";
// Compare using invariant culture.
if(String.Compare(pswd, str,
StringComparison.InvariantCulture) == 0)
Console.WriteLine("Password accepted.");
else
Console.WriteLine("Password invalid.");
}
}
Output Password invalid.
|
HTML code for linking to this page:
Related in same category :
-
-
-
-
-
-
-
-
-
|