How do you check if a string passwordText contains at least
- 1 alphabet character
- 1 number
- 1 special character (a symbol)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Try this:
Though you might want to be a little more specific about what you mean by ‘alphabet character’, ‘number’ and ‘symbol’ because these terms mean different things to different people and it’s not certain that your definition of these terms matches the definitions the framework uses.
I would guess that by letter you mean ‘a-z’ or ‘A-Z’, by digit you mean ‘0-9’ and by symbol you mean any other printable ASCII character. If so, try this:
If in fact you mean something else then adjust the above methods accordingly.