Creating a password checker using a function
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
So im trying to create a password checker that checks for: length of at least 8 characters 1 upper case and 1 lower case but im stuck. This is what i have so far but none of it is working
if true
% code
function [len] = isValidPasswordFUNC(password)
% A function that checks a password to be valid
% Checking the length of the password
len = length(password)
if len < 8
disp('Invalid password is too short');
else
disp('Password is Valid length');
end
Then the script:
if true
% code
close all
clear
clc
password = input('Enter your password: ');
function [len] = isValidPasswordFUNC(password);
end
Thanks any help or a point in a direction is very helpful thanks
0 Commenti
Risposte (1)
Guillaume
il 27 Mag 2018
Modificato: Guillaume
il 27 Mag 2018
Sounds like homework, so I won't give you the solution. I'll just tell you to have a look at isstrprop.
Also, should your checking function return the length of the password or an indication of whether or not the password is valid? The latter would make more sense to me.
Vedere anche
Categorie
Scopri di più su Data Type Conversion in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!