Write code to Remove all whitespaces and non visible characters such as tab, \n. using regex
//package com.book2s; public class Main { public static void main(String[] argv) { String str = "book2s.com"; System.out.println(removeAllSpace(str)); }//w w w.ja v a 2 s. com /** * Remove all whitespaces and non visible characters such as tab, \n. * * @param str * @return String */ public static String removeAllSpace(String str) { return str.replaceAll("\\s+", ""); } }