public static char[] add( char[] array, String str ) { return add( array, str.toCharArray() ); }
public static char[] add( char[] array, String str ) { return add( array, str.toCharArray() ); }
public static char[] add( char[] array, StringBuilder stringBuilder ) { return add( array, getCharsFromStringBuilder( stringBuilder ) ); }
public static char[] add( char[] array, StringBuilder stringBuilder ) { return add( array, getCharsFromStringBuilder( stringBuilder ) ); }
/** * remove chars from a string * @param string string to split * @param delimiters delimeters to remove * @return the split up string */ public static String removeChars( final String string, final char... delimiters ) { char[][] comps = CharScanner.splitByCharsNoneEmpty( FastStringUtils.toCharArray( string ), delimiters ); return new String(Chr.add(comps)); }
/** * Add a char to a string * @param str string * @param c char * @return new string */ public static String add( String str, char c ) { return FastStringUtils.noCopyStringFromChars( Chr.add( FastStringUtils.toCharArray(str), c ) ); }
/** * remove chars from a string * @param string string to split * @param delimiters delimeters to remove * @return the split up string */ public static String removeChars( final String string, final char... delimiters ) { char[][] comps = CharScanner.splitByCharsNoneEmpty( FastStringUtils.toCharArray( string ), delimiters ); return new String(Chr.add(comps)); }
/** * Add a char to a string * @param str string * @param c char * @return new string */ public static String add( String str, char c ) { return FastStringUtils.noCopyStringFromChars( Chr.add( FastStringUtils.toCharArray(str), c ) ); }
public static char[] insert( final char[] array, final int idx, final char v ) { Exceptions.requireNonNull( array ); if ( idx >= array.length ) { return add( array, v ); } final int index = calculateIndex( array, idx ); //Object newArray = Array.newInstance(array.getClass().getComponentType(), array.length+1); char[] newArray = new char[ array.length + 1 ]; if ( index != 0 ) { /* Copy up to the length in the array before the index. */ /* src sbegin dst dbegin length of copy */ arraycopy ( array, 0, newArray, 0, index ); } boolean lastIndex = index == array.length - 1; int remainingIndex = array.length - index; if ( lastIndex ) { /* Copy the area after the insert. Make sure we don't write over the end. */ /* src sbegin dst dbegin length of copy */ arraycopy ( array, index, newArray, index + 1, remainingIndex ); } else { /* Copy the area after the insert. */ /* src sbegin dst dbegin length of copy */ arraycopy ( array, index, newArray, index + 1, remainingIndex ); } newArray[ index ] = v; return newArray; }
public static char[] insert( final char[] array, final int idx, final char v ) { Exceptions.requireNonNull( array ); if ( idx >= array.length ) { return add( array, v ); } final int index = calculateIndex( array, idx ); //Object newArray = Array.newInstance(array.getClass().getComponentType(), array.length+1); char[] newArray = new char[ array.length + 1 ]; if ( index != 0 ) { /* Copy up to the length in the array before the index. */ /* src sbegin dst dbegin length of copy */ arraycopy ( array, 0, newArray, 0, index ); } boolean lastIndex = index == array.length - 1; int remainingIndex = array.length - index; if ( lastIndex ) { /* Copy the area after the insert. Make sure we don't write over the end. */ /* src sbegin dst dbegin length of copy */ arraycopy ( array, index, newArray, index + 1, remainingIndex ); } else { /* Copy the area after the insert. */ /* src sbegin dst dbegin length of copy */ arraycopy ( array, index, newArray, index + 1, remainingIndex ); } newArray[ index ] = v; return newArray; }
public static char[] insert( final char[] array, final int fromIndex, final char[] values ) { Exceptions.requireNonNull( array ); if ( fromIndex >= array.length ) { return add( array, values ); } final int index = calculateIndex( array, fromIndex ); //Object newArray = Array.newInstance(array.getClass().getComponentType(), array.length+1); char[] newArray = new char[ array.length + values.length ]; if ( index != 0 ) { /* Copy up to the length in the array before the index. */ /* src sbegin dst dbegin length of copy */ arraycopy ( array, 0, newArray, 0, index ); } boolean lastIndex = index == array.length - 1; int toIndex = index + values.length; int remainingIndex = newArray.length - toIndex; if ( lastIndex ) { /* Copy the area after the insert. Make sure we don't write over the end. */ /* src sbegin dst dbegin length of copy */ arraycopy ( array, index, newArray, index + values.length, remainingIndex ); } else { /* Copy the area after the insert. */ /* src sbegin dst dbegin length of copy */ arraycopy ( array, index, newArray, index + values.length, remainingIndex ); } for ( int i = index, j = 0; i < toIndex; i++, j++ ) { newArray[ i ] = values[ j ]; } return newArray; }
public static char[] insert( final char[] array, final int fromIndex, final char[] values ) { Exceptions.requireNonNull( array ); if ( fromIndex >= array.length ) { return add( array, values ); } final int index = calculateIndex( array, fromIndex ); //Object newArray = Array.newInstance(array.getClass().getComponentType(), array.length+1); char[] newArray = new char[ array.length + values.length ]; if ( index != 0 ) { /* Copy up to the length in the array before the index. */ /* src sbegin dst dbegin length of copy */ arraycopy ( array, 0, newArray, 0, index ); } boolean lastIndex = index == array.length - 1; int toIndex = index + values.length; int remainingIndex = newArray.length - toIndex; if ( lastIndex ) { /* Copy the area after the insert. Make sure we don't write over the end. */ /* src sbegin dst dbegin length of copy */ arraycopy ( array, index, newArray, index + values.length, remainingIndex ); } else { /* Copy the area after the insert. */ /* src sbegin dst dbegin length of copy */ arraycopy ( array, index, newArray, index + values.length, remainingIndex ); } for ( int i = index, j = 0; i < toIndex; i++, j++ ) { newArray[ i ] = values[ j ]; } return newArray; }
/** * Add one string to another * @param str string 1 * @param str2 string 2 * @return new string */ public static String add( String str, String str2 ) { return FastStringUtils.noCopyStringFromChars( Chr.add( FastStringUtils.toCharArray(str), FastStringUtils.toCharArray(str2) ) ); }
/** * Add one string to another * @param str string 1 * @param str2 string 2 * @return new string */ public static String add( String str, String str2 ) { return FastStringUtils.noCopyStringFromChars( Chr.add( FastStringUtils.toCharArray(str), FastStringUtils.toCharArray(str2) ) ); }
public char[] readNumber( ) { try { ensureBuffer(); char [] results = CharScanner.readNumber( readBuf, index, length); index += results.length; if (index >= length && more) { ensureBuffer(); if (length!=0) { char results2[] = readNumber(); return Chr.add(results, results2); } else { return results; } } else { return results; } } catch (Exception ex) { String str = CharScanner.errorDetails ( "readNumber issue", readBuf, index, ch ); return Exceptions.handle ( char[].class, str, ex ); } }
return Chr.add(results, results2); } else { return Exceptions.die(char[].class, "Unable to find close char " + (char) match + " " + new String(results));
public char[] readNumber( ) { try { ensureBuffer(); char [] results = CharScanner.readNumber( readBuf, index, length); index += results.length; if (index >= length && more) { ensureBuffer(); if (length!=0) { char results2[] = readNumber(); return Chr.add(results, results2); } else { return results; } } else { return results; } } catch (Exception ex) { String str = CharScanner.errorDetails ( "readNumber issue", readBuf, index, ch ); return Exceptions.handle ( char[].class, str, ex ); } }
return Chr.add(results, results2); } else { return Exceptions.die(char[].class, "Unable to find close char " + (char) match + " " + new String(results));