brewersfan1976

password_check.rb

Dec 21st, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.51 KB | None | 0 0
  1. def passwordCheck(inputString)
  2.     caps = ("A".."Z")
  3.     all_caps = caps.to_a.join
  4.     lowercase = ("a".."z")
  5.     all_lower = lowercase.to_a.join
  6.     digit = ("0".."9")
  7.     all_digit = digit.to_a.join
  8.    
  9.     if inputString.length >= 5 then
  10.        if inputString.count(all_caps) >= 1 then
  11.           if inputString.count(all_lower) >= 1 then
  12.              if inputString.count(all_digit) >= 1 then
  13.                 return true
  14.              end
  15.           end
  16.        end
  17.     end
  18.          
  19.     return false
  20. end
Advertisement
Add Comment
Please, Sign In to add comment