function displayStr = displayHelp(hp)
    if ~isempty(hp.helpStr)
        displayStr = hp.helpStr;
    elseif ~isempty(hp.topic)
        inaccessibleMessage = matlab.internal.language.introspective.findInaccessibleFunctions(hp.topic);
        if isempty(inaccessibleMessage)
            inaccessibleMessage = matlab.internal.language.registry.findUnlicensedFunctions(hp.topic);
        end
        if isempty(inaccessibleMessage)
            if hp.wantHyperlinks
                searchMessage = getString(message('MATLAB:helpUtils:displayHelp:SearchMessageWithLinks', erase(helpUtils.makeDualCommand('docsearch', hp.topic), '"')));
            else
                searchMessage = getString(message('MATLAB:helpUtils:displayHelp:SearchMessageNoLinks'));
            end
            displayStr = [getString(message('MATLAB:helpUtils:displayHelp:TopicNotFound', hp.topic)), newline, searchMessage];
        else
            displayStr = getString(inaccessibleMessage);
        end
    else
        if hp.wantHyperlinks
            displayStr = getString(message('MATLAB:helpUtils:displayHelp:GettingStarted'));
        else
            displayStr = getString(message('MATLAB:helpUtils:displayHelp:SearchMessageNoLinks'));
        end
    end
end

%   Copyright 2007 The MathWorks, Inc.
