Cleans a string by removing standard control characters (tab, line-feed, carriage-return) and trimming redundant spaces. Allows for an optional RegExp to specify additional matches to remove.
The string to clean
Optional
Optional RegExp pattern to remove from the string
The cleaned string
trimAll(' hello \t world \n'); // 'hello world' Copy
trimAll(' hello \t world \n'); // 'hello world'
Cleans a string by removing standard control characters (tab, line-feed, carriage-return) and trimming redundant spaces. Allows for an optional RegExp to specify additional matches to remove.