هذا الكود يحلل النص ويعطيك نتيجة وجود أو عدم وجود كل من الأرقام Digit والأحرف (بشكل عام) Letter والأحرف الصغيرة Lower والأحرف الكبير ةUpper والرموز Symbol
ومن النتيجة تهرف ماذا تريد أن تفعل
PHP كود :
Dim Digit As Boolean = txt.ToCharArray.Any(Function(c As Char) Char.IsDigit(c)) Dim Letter As Boolean = txt.ToCharArray.Any(Function(c As Char) Char.IsLetter(c)) Dim Lower As Boolean = txt.ToCharArray.Any(Function(c As Char) Char.IsLower(c)) Dim Upper As Boolean = txt.ToCharArray.Any(Function(c As Char) Char.IsUpper(c)) Dim Symbol As Boolean = txt.ToCharArray.Any(Function(c As Char) Char.IsSymbol(c))
الآن ممكن تختبر وجود أي احتمال مثال
PHP كود :
If Not Digit Then MsgBox("يجب أن تحتوي كلمة المرور على أرقام") Return End If
If Not Letter Then MsgBox("يجب أن تحتوي كلمة المرور على أحرف") Return End If
If Not Lower Then MsgBox("يجب أن تحتوي كلمة المرور على أحرف صغيرة") Return End If
If Not Upper Then MsgBox("يجب أن تحتوي كلمة المرور على أحرف كبيرة") Return End If
If Not Symbol Then MsgBox("يجب أن تحتوي كلمة المرور على رموز") Return End If