def line_to_variable(line):
    """
    >>> line_to_variable('   public static String CheckSelectorResultMessageFactory_SqlExceptionMessage;\\n\\r')
    'CheckSelectorResultMessageFactory_SqlExceptionMessage'
    >>> line_to_variable('  public static String ResultTableEditor_CHANGES_SUCCESFUL_STORED;\\n')
    'ResultTableEditor_CHANGES_SUCCESFUL_STORED'
    """
    # a variable cannot contain spaces, so we can split it to get the elements
    elements = line.split()
    for i, elem in enumerate(elements):
        if elem == "String":
            variable = elements[i+1] # the next one
            break
    else:
        raise ValueError("invalid line: did not contain String")
    # remove potential trailing semicolon
    return variable.replace(";", "")