validate_user_str_cs#

pybear.base.validate_user_str_cs(user_prompt, options)#

Case sensitive validation of a single user-entered alpha character against a list of allowed characters.

Parameters:
user_promptstr

Text string displayed to the user at prompt.

optionsstr

A single text string containing the allowed characters. Case sensitive.

Returns:
user_inputstr

Validated user selection.

Examples

>>> from pybear.input_validation import validate_user_str_cs
>>> out = validate_user_str_cs('Enter selection > ', 'abc')
Enter Selection > A
>>> # prompts again because of invalid selection (case does not match)
Enter Selection > a
>>> out
a