How to remove space from String using Javascript
February 04, 2021
1 min

If you want to format a string and remove all whitespace, like passing from 'Hello my name is Olive' to 'HelloMyNameIsOlive' there is a simple function for that :

const deleteSpaceString = (string: string) => string.replace(/\s+/g, '')

This function for deleting all whitespace can be useful for formatting document path to avoid any error. From var/user/me/my document saved like this.doc to var/user/me/my documentsavedlikethis.doc

Or creating id from name of city : San Francisco to SanFrancisco



Related Posts

How to convert a Number into a String using Javascript
September 17, 2020
1 min
© 2023, All Rights Reserved.

Quick Links

Contact Us

Social Media