String Validators

  • + 0 comments

    <#> def check_string(s): ''' Function to check if a string contains any characters that are alpha-numeric, alphabetical, digits, lowercase and uppercase. ''' alnum, alpha, digit, lower, upper = False, False, False, False, False for ch in s: if(alnum == False and ch.isalnum()): alnum = True if(alpha == False and ch.isalpha()): alpha = True if(digit == False and ch.isdigit()): digit = True if(lower == False and ch.islower()): lower = True if(upper == False and ch.isupper()): upper = True

    print(alnum)
    print(alpha)
    print(digit)
    print(lower)
    print(upper)
    return
    

    <#>