@Test public void testRemoveWhiteSpaces() { Assert.assertNull(StringUtils.removeWhiteSpaces(null)); Assert.assertEquals("", StringUtils.removeWhiteSpaces("")); Assert.assertEquals("foobar", StringUtils.removeWhiteSpaces("foobar")); Assert.assertEquals("foobar", StringUtils.removeWhiteSpaces("foo bar")); Assert.assertEquals("foobar", StringUtils.removeWhiteSpaces("foo bar")); Assert.assertEquals("foobar", StringUtils.removeWhiteSpaces(" foo bar ")); Assert.assertEquals("foobar", StringUtils.removeWhiteSpaces("foo\nbar")); Assert.assertEquals("foobar", StringUtils.removeWhiteSpaces("foo\n\nbar")); Assert.assertEquals("foobar", StringUtils.removeWhiteSpaces("foo\rbar")); Assert.assertEquals("foobar", StringUtils.removeWhiteSpaces("foo\r\n bar")); Assert.assertEquals("foobar", StringUtils.removeWhiteSpaces("foo\r\nbar\n")); Assert.assertEquals("foobar", StringUtils.removeWhiteSpaces("\rfoo\n bar")); Assert.assertEquals("foobar", StringUtils.removeWhiteSpaces("\rfoo bar\n")); }
public static String removeWhiteSpaces(String string) { if (string == null) return null; return string.replaceAll("\\s+", ""); }
StringUtils { public static String removeWhiteSpaces(String string) { if (string == null) return null; return string.replaceAll("\\s+", ""); } }
StringUtils { public static String removeWhiteSpaces(String string) { if (string == null) return null; return string.replaceAll("\\s+", ""); } private  StringUtils(); }
StringUtils { public static String removeWhiteSpaces(String string) { if (string == null) return null; return string.replaceAll("\\s+", ""); } private  StringUtils(); static String byteToHex(byte[] data); static String replaceLineBreaksWithSpace(String string); static String collapseLineBreaks(String string); static String replaceLineBreaks(String string, String replace); static String removeWhiteSpaces(String string); static String tryTrim(String string); static int getLevenshteinDistance(CharSequence s, CharSequence t); static String join(Object[] array, char separator); static String join(Object[] array, char separator, int startIndex, int endIndex); static String join(Iterator<T> iterator, String separator); static String join(Collection<T> collection, String separator); }
StringUtils { public static String removeWhiteSpaces(String string) { if (string == null) return null; return string.replaceAll("\\s+", ""); } private  StringUtils(); static String byteToHex(byte[] data); static String replaceLineBreaksWithSpace(String string); static String collapseLineBreaks(String string); static String replaceLineBreaks(String string, String replace); static String removeWhiteSpaces(String string); static String tryTrim(String string); static int getLevenshteinDistance(CharSequence s, CharSequence t); static String join(Object[] array, char separator); static String join(Object[] array, char separator, int startIndex, int endIndex); static String join(Iterator<T> iterator, String separator); static String join(Collection<T> collection, String separator); static final String EMPTY; static final String SPACE; }