@@ -0,0 +1,1663 @@
+/*%0D%0A * Copyright (c) 2013 mgm technology partners GmbH%0D%0A *%0D%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0D%0A * you may not use this file except in compliance with the License.%0D%0A * You may obtain a copy of the License at%0D%0A *%0D%0A *     http://www.apache.org/licenses/LICENSE-2.0%0D%0A *%0D%0A * Unless required by applicable law or agreed to in writing, software%0D%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0D%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0D%0A * See the License for the specific language governing permissions and%0D%0A * limitations under the License.%0D%0A */%0D%0Apackage com.mgmtp.jfunk.common.util;%0D%0A%0D%0Aimport java.util.regex.Pattern;%0D%0A%0D%0Aimport org.apache.commons.lang3.StringUtils;%0D%0A%0D%0A/**%0D%0A * Utility functions.%0D%0A * %0D%0A * @author rnaegele%0D%0A * @since 3.1.0%0D%0A */%0D%0Apublic class JFunkUtils %7B%0D%0A%0D%0A%09private static final Pattern NBSP_PATTERN = Pattern.compile(%22%5C%5Cu00A0+%22);%0D%0A%0D%0A%09/**%0D%0A%09 * Removes leading and trailing whitespace and replaces sequences of whitespace characters by a single space. As opposed to%0D%0A%09 * %7B@link Character#isWhitespace(char)%7D or %7B@link StringUtils#isWhitespace(CharSequence)%7D, this funtion also considers%0D%0A%09 * non-breaking spaces (ASCII 160) as whitespace.%0D%0A%09 * %0D%0A%09 * @param value%0D%0A%09 *            the string to normalize whitespaces from, may be null%0D%0A%09 * @return the modified string with whitespace normalized, or %7B@code null%7D if null was passed in%0D%0A%09 */%0D%0A%09public static String normalizeSpace(final String value) %7B%0D%0A%09%09if (value == null) %7B%0D%0A%09%09%09return null;%0D%0A%09%09%7D%0D%0A%09%09String result = NBSP_PATTERN.matcher(value).replaceAll(%22 %22);%0D%0A%09%09return StringUtils.normalizeSpace(result);%0D%0A%09%7D%0D%0A%7D%0D%0A

Add normalizeSpace method