Java String Sanitize sanitizeLineSpaces(String line)

Here you can find the source of sanitizeLineSpaces(String line)

Description

Replaces all tabs and multiple spaces with a single space

License

Apache License

Parameter

Parameter Description
line the line to sanitize

Return

the sanitized line

Declaration

public static String sanitizeLineSpaces(String line) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**//from   w w  w.  j  a  va 2 s .c  o m
     * Replaces all tabs and multiple spaces with a single space
     * 
     * @param line
     *            the line to sanitize
     * @return the sanitized line
     */
    public static String sanitizeLineSpaces(String line) {
        return line.replaceAll("\\s+", " ").trim();
    }
}

Related

  1. sanitizeIDs(String str)
  2. sanitizeInput(String input)
  3. sanitizeInput(String string)
  4. sanitizeJavascript(String originalString)
  5. sanitizeLine(String line)
  6. sanitizeLoggerNamePart(String name)
  7. sanitizeMethodName(String methodName)
  8. sanitizeMimeType(final String mimeType)
  9. sanitizeName(String input)