@ Nonnull public static String removeMultiple ( @ Nullable final String sInputString , @ Nonnull final char [ ] aRemoveChars ) { ValueEnforcer . notNull ( aRemoveChars , "RemoveChars" ) ; // Any input text? if ( hasNoText ( sInputString ) ) return "" ; // Anything to remove? if ( aRemoveChars . length == 0 ) return sInputString ; final StringBuilder aSB = new StringBuilder ( sInputString . length ( ) ) ; iterateChars ( sInputString , cInput -> { if ( ! ArrayHelper . contains ( aRemoveChars , cInput ) ) aSB . append ( cInput ) ; } ) ; return aSB . toString ( ) ; }
Optimized remove method that removes a set of characters from an input string!