Remove All Whitespace
Removes all whitespace from a string.
- string
- whitespace
Install
npx shadcn@latest add https://quicksnip.dev/r/remove-all-whitespace.jsonThis snippet is not verified yet. Review it before use, or help verify it.
Code
function removeWhitespace(str) {
return str.replace(/\s+/g, '');
}Usage
removeWhitespace('Hello world!'); // Returns: 'Helloworld!'