SELECT `justfunctions.eu.remove_extra_spaces`("\tHi there .\n\n")
/*--Output--
Hi there.
*/
CREATE OR REPLACE FUNCTION `your_project_id.your_dataset_id.remove_extra_spaces`(`string` string)
RETURNS string AS (TRIM(REGEXP_REPLACE(REGEXP_REPLACE(string,r'\n+|\t+|\r+|\\n+|\\t+|\\r+|\\s+',''), r'\s+', ' ')))
OPTIONS ( description = '''Removes extra spaces (tab, space, newline, paragraph, etc.) in a <string>.''')
SQL User Defined Function (SQL UDF)
See something wrong? Contact us or report an issue on Github.