i’m learning about how to create a good and clean code, and i’m just need to review something like that, and i really not sure how can i fix this code into a clean code.
bool isValidUserName(const std::string& username)
{
bool valid = false;
if (username.length() >= MIN_NAME_LENGTH)
{
if (username.length() <= MAX_NAME_LENGTH)
{
if (isalpha(username[0]))
{
bool foundNotValidChar = std::find_if(username.begin(), username.end(), isNotValid) != username.end();
if (!foundNotValidChar)
{
valid = true;
}
}
}
}
return valid;
}
Source: Windows Questions C++