View Javadoc
1   /*
2    * REPOWEB, repository manager.
3    *
4    * Terms of license - http://opensource.org/licenses/apachepl.php
5    */
6   package org.repoweb.pom;
7   /***
8    * Set of String utilities methods.
9    * @version $Revision: 1.3 $
10   */
11  final class StringUtil {
12      private StringUtil() {}
13  
14      /***
15       * Flatten a string. It removes duplicate whitespace and LF.
16       * @param str a string
17       * @return Flattened string
18       */
19      public static String flatten(String str) {
20          if (str == null) {
21              return null;
22          }
23          return str.trim().replaceAll("[ \t\n\f\r]+", " ");
24      }
25  }