/** * Gets rid of null characters lurking in the string * @param str string * @return new string */ public static String compact( String str ) { return FastStringUtils.noCopyStringFromChars( Chr.compact( FastStringUtils.toCharArray(str) ) ); }
/** * Gets rid of null characters lurking in the string * @param str string * @return new string */ public static String compact( String str ) { return FastStringUtils.noCopyStringFromChars( Chr.compact( FastStringUtils.toCharArray(str) ) ); }
/** * Gets rid of null characters lurking in the string * @param str string * @return new string */ public static String compact( String str ) { return FastStringUtils.noCopyStringFromChars( Chr.compact( FastStringUtils.toCharArray(str) ) ); }
@Test public void compactTest() { char[] letters = array( 'a', 'b', '\0', '\0', '\0', '\0', '\0', 'c', '\0', 'd', 'e' ); letters = compact( letters ); assertArrayEquals( array( 'a', 'b', 'c', 'd', 'e' ), letters ); }