/ Published in: C#
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
public bool ComparePasswords(string OldPassword, string NewPassword) { bool match4 = true; int diffCount = 0; string s = OldPassword; string t = NewPassword; for (int i = 0; i < s.Length; i++) { if (i >= t.Length) { break; } else if (s[i] != t[i]) { diffCount++; } else if (s[i] == t[i]) { diffCount = 0; } if (diffCount == 4) { match4 = false; break; } } return match4; }