I've encountered an issue where the code below removes all spaces, but it's also removing the enter key.
Is there a way to remove only spaces and not affect the enter key?
static stripDoubleSpaces(str: string): string {
if (!!str) {
return str.replace(/\s+/g, ' ');
} else {
return str;
}
}