Node.js examples for String:Char
Remove all of the characters of a given string from a string
/* Remove all of the characters of a given string from a string * * "Abracadabra".removechars('ar') // => "Abcdb" *///from w w w .j av a 2s. c o m String.prototype.removechars = function ( chars ) { if ( arguments.length > 1 ) { chars = Array.prototype.join.call( arguments, '' ); } var rx = RegExp.compile('['+RegExp.escape(chars)+']', 'g'); return this.replace( rx, '' ); };