01 April 2017

variableName

My solution:
bool variableName(string name)
{
    if (Regex.IsMatch(name, "^\\d"))
        return false;
    if (name.All(c => ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) || char.IsDigit(c) || c == '_'))
        return true;

    return false;
}

Previous Next