[Schmitzm-commits] r1660 - trunk/schmitzm-core/src/main/java/de/schmitzm/lang

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Jul 29 16:41:14 CEST 2011


Author: alfonx
Date: 2011-07-29 16:41:14 +0200 (Fri, 29 Jul 2011)
New Revision: 1660

Modified:
   trunk/schmitzm-core/src/main/java/de/schmitzm/lang/LangUtil.java
Log:
tabs werden auch als whitespaces removed

Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/lang/LangUtil.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/lang/LangUtil.java	2011-07-29 14:19:37 UTC (rev 1659)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/lang/LangUtil.java	2011-07-29 14:41:14 UTC (rev 1660)
@@ -1916,21 +1916,25 @@
 	 * 
 	 * @author gregor
 	 */
-	public static String removeWhitespacesToEmpty(String string) {
-		if (string == null)
-			return "";
+    public static String removeWhitespacesToEmpty(String string) {
+        if (string == null)
+                return "";
 
-		// Alle Zeilenumbrüche raus
-		Matcher matcher = RegexCache.getInstance().getPattern("[\\n|\\r|\\u0085|\\u2028|\\u2029]").matcher(string);
-		string = matcher.replaceAll(" ");
-		
-		// Geschützte Leerzeichen weg
-		matcher = RegexCache.getInstance().getPattern("\\\u00A0").matcher(string);
-		string = matcher.replaceAll(" ");
-		
-		// Leerraum konsolidieren
-		matcher = RegexCache.getInstance().getPattern("\\s{2,}").matcher(string);
-		return matcher.replaceAll(" ");
-	}
+        // Alle Zeilenumbrüche raus
+        Matcher matcher = RegexCache.getInstance().getPattern("[\\n|\\r|\\u0085|\\u2028|\\u2029]").matcher(string);
+        string = matcher.replaceAll(" ");
+        
+        // Geschützte Leerzeichen weg
+        matcher = RegexCache.getInstance().getPattern("\\u00A0").matcher(string);
+        string = matcher.replaceAll(" ");
 
+        // Tabulator -> Leer
+        matcher = RegexCache.getInstance().getPattern("\\t").matcher(string);
+        string = matcher.replaceAll(" ");
+        
+        // Leerraum konsolidieren
+        matcher = RegexCache.getInstance().getPattern("\\s{2,}").matcher(string);
+        return matcher.replaceAll(" ");
 }
+
+}



More information about the Schmitzm-commits mailing list