Java String Whitespace Delete deleteWhitespaces(final String string)

Here you can find the source of deleteWhitespaces(final String string)

Description

Deletes all white-spaces from the given string.

License

LGPL

Parameter

Parameter Description
string the string that whose white-spaces shall be removed

Return

a string without white-spaces or null if the given string was null

Declaration

public static String deleteWhitespaces(final String string) 

Method Source Code

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

public class Main {
    /**/*from  w  w  w.j  a  va2 s.  c om*/
     * Deletes all white-spaces from the given string.
     *
     * @param   string  the string that whose white-spaces shall be removed
     *
     * @return  a string without white-spaces or <code>null</code> if the given string was null
     */
    public static String deleteWhitespaces(final String string) {
        if (string == null) {
            return null;
        }

        return string.replaceAll("\\s", ""); // NOI18N
    }
}

Related

  1. deleteWhitespace(String str)
  2. deleteWhitespace(String str)
  3. deleteWhitespace(String str)
  4. deleteWhitespace(String str)
  5. deleteWhitespace(String string)
  6. deleteWhiteSpaces(String nodeValue)