Skip to content

Instantly share code, notes, and snippets.

@dramaturg
Created September 30, 2014 13:34
Show Gist options
  • Save dramaturg/356fe6d33f14936c7d97 to your computer and use it in GitHub Desktop.
Save dramaturg/356fe6d33f14936c7d97 to your computer and use it in GitHub Desktop.
-- Helper function to do whitespace cleanup
DELIMITER $$
CREATE FUNCTION ugly_trim(s VARCHAR(1000))
RETURNS VARCHAR(1000)
DETERMINISTIC
BEGIN
DECLARE temp VARCHAR(1000);
SET temp = '';
SET temp =
REPLACE(
REPLACE(
REPLACE(
REPLACE(
REPLACE(
REPLACE(
REPLACE(
REPLACE(
REPLACE(s
, ' ', ' ')
, ' ', ' ')
, ' ', ' ')
, ' ', ' ')
, ' ', ' ')
, ' ', ' ')
, ' ', ' ')
, ' ', ' ')
, ' ', ' ');
RETURN temp;
END$$
DELIMITER ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment