c - How to search a string for a particular character or number or punctuation character -


i know use ctype.h various comparisons.i can make program have check weather given character upper case or lower case. suppose have entered string "singh21$" how check string contains uppercase,a dollar sign , @ least number. if string contains these 3 "its strong password".

you can try this:

for(int =0; < strlen(stringpassword); ++i) {      if( islower(stringpassword[i]) )         haslower = true;      if( isupper(stringpassword[i]) )         hasupper = true;      if( isdigit(stringpassword[i]) )         hasdigit = true;      if( isalnum(stringpassword[i]) )         hasspecial = true; } 

and if flags true consider strong password.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -