@@ -0,0 +1,2760 @@
+/*%0A * Zed Attack Proxy (ZAP) and its related class files.%0A * %0A * ZAP is an HTTP/HTTPS proxy for assessing web application security.%0A * %0A * Copyright 2015 The ZAP Development Team%0A * %0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage org.zaproxy.zap.utils;%0A%0Aimport java.util.regex.Pattern;%0A%0A/**%0A * Utility methods to manipulate %7B@code String%7Ds, mainly shown in UI.%0A * %3Cp%3E%0A * Allows to show whitespace characters (spaces, newlines and tabs).%0A *%0A * @since 2.4.0%0A */%0Apublic final class StringUIUtils %7B%0A%0A    public static final String SPACE_SYMBOL = %22%5Cu00b7%22;%0A    public static final String TAB_SYMBOL = %22%5Cu00bb%22;%0A    public static final String CARRIAGE_RETURN_SYMBOL = %22%5Cu00a4%22;%0A    public static final String LINE_FEED_SYMBOL = %22%5Cu00b6%22;%0A%0A    private StringUIUtils() %7B%0A    %7D%0A%0A    /**%0A     * Returns a string with visible whitespace characters, removing the invisible ones.%0A     * %3Cp%3E%0A     * It's replaced carriage return, line feed, tabs and spaces with visible (replacement) characters.%0A     *%0A     * @param string the source string%0A     * @return the new string with visible new line characters%0A     */%0A    public static String replaceWithVisibleWhiteSpaceChars(String string) %7B%0A        return string.replaceAll(%22%5Cr%22, CARRIAGE_RETURN_SYMBOL)%0A                .replaceAll(%22%5Cn%22, LINE_FEED_SYMBOL)%0A                .replaceAll(%22%5C%5Ct%22, TAB_SYMBOL)%0A                .replaceAll(%22 %22, SPACE_SYMBOL);%0A    %7D%0A%0A    /**%0A     * Returns a string with visible new line characters, shown along the invisible ones.%0A     *%0A     * @param string the source string%0A     * @return the new string with visible new line characters%0A     */%0A    public static String addVisibleNewLineChars(String string) %7B%0A        return string.replaceAll(%22%5Cr%22, CARRIAGE_RETURN_SYMBOL + %22%5Cr%22).replaceAll(%22%5Cn%22, LINE_FEED_SYMBOL + %22%5Cn%22);%0A    %7D%0A%0A    /**%0A     * Tells whether or not the given %7B@code string%7D contains or not new line characters (both line feed as carriage return).%0A     *%0A     * @param string the string that will be tested%0A     * @return %7B@code true%7D if the string contains at least one new line character, %7B@code false%7D otherwise.%0A     */%0A    public static boolean containsNewLineChars(String string) %7B%0A        return Pattern.compile(%22%5C%5Cr?%5C%5Cn%22).matcher(string).find();%0A    %7D%0A%7D%0A

Add StringUIUtils that allows to show whitespace chars