>>If you mean in a VFP app, it should be pretty easy. Spin through the string, looking at each character. Keep a running count of how many are ISDIGIT(), ISUPPER() and ISLOWER(). You have a strong password if:
>>
>>( LEN() >= 6 ) AND( DigitCount >= 1 ) AND ( NonDigitCount >= 2 ) AND ( UpperCount >= 1 ) AND ( LowerCount >= 1 )
>
>I doänt understand the need for NonDigitCount. Is the following code best way to check for a strong password ?
>
>
FUNCTION IsStrongPassword( cStr )
>
>LOCAL i, nDigitCount, nUpperCount, nLowerCount
>STORE 0 TO nDigitCount, nUpperCount, nLowerCount
>FOR i=1 TO LEN(cStr)
> DO case
> CASE ISDIGIT( SUBSTR(m.cStr,m.i))
> nDigitCount = nDigitCount + 1
>
> CASE ISUPPER(SUBSTR(m.cStr,m.i))
> nUpperCount = nUpperCount + 1
>
> CASE ISLOWER(SUBSTR(m.cStr,m.i))
> nLowerCount = nLowerCount + 1
> ENDCASE
>ENDFOR
>
>RETURN LEN(m.cStr)>5 AND m.nUpperCount>0 AND m.nLowerCount>0 AND m.nDigitCount>0
Sure, that should be fine. I couldn't remember off the top of my head whether ISUPPER() returned .T. if it was a character or if it might return .T. for a digit. But, those two return .T. only for characters.
Note I added m.nDigitCount to your RETURN line.
You also might want to test with high-ASCII characters; some people like to use them for strong passwords and I don't know how ISUPPER() etc. works with those.
Regards. Al
"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov
Neither a despot, nor a doormat, be
Every app wants to be a database app when it grows up