public static String addWhitespaceQuoting(final String storedText) {
        String userText;
        if (storedText == null || storedText.isEmpty()) {
            userText = storedText;
        } else {
            final String escapedText = storedText.replace("\"", "\\\"");
            if (storedText.startsWith(" ")
                    || storedText.startsWith("\t")
                    || storedText.endsWith(" ")
                    || storedText.endsWith("\t")) {
                // leading/trailing whitespace so dbl quote the whole thing
                // ' he said "hello" ' => '" he said \"hello\" "'
                userText = "\""
                        + escapedText
                        + "\"";
            } else {
                userText = escapedText;
            }
        }
        return userText;
    }
Converts a system stored value into one for display in the UI.
If the value has leading or trailing whitespace it will be quoted and any
double quotes escaped.
See the tests for examples.
stroom-util-shared/src/main/java/stroom/util/shared/StringUtil.java