remove_extra_whitespaces(string)
Removes extra whitespaces in a <string>.
CREATE OR REPLACE FUNCTION `justfunctions.eu.remove_extra_whitespaces`(`string` string)
RETURNS string AS (REGEXP_REPLACE(string, r'\s+',' '))
OPTIONS ( description = '''Removes extra whitespaces in a <string>.''')
Example
SELECT `justfunctions.eu.remove_extra_whitespaces`("Hi there
.")
Hi there
.