Last active
March 17, 2020 14:05
-
-
Save jrobinsonc/34ca7755a227330a4891332abb1f83c6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP FUNCTION `quit_accents`; | |
CREATE FUNCTION `quit_accents`(str longtext) | |
RETURNS longtext CHARSET utf8 | |
BEGIN | |
DECLARE result LONGTEXT; | |
SET result = str; | |
SET result = REPLACE(result, 'á', 'a'); | |
SET result = REPLACE(result, 'é', 'e'); | |
SET result = REPLACE(result, 'í', 'i'); | |
SET result = REPLACE(result, 'ó', 'o'); | |
SET result = REPLACE(result, 'ú', 'u'); | |
SET result = REPLACE(result, 'Á', 'A'); | |
SET result = REPLACE(result, 'É', 'E'); | |
SET result = REPLACE(result, 'Í', 'I'); | |
SET result = REPLACE(result, 'Ó', 'O'); | |
SET result = REPLACE(result, 'Ú', 'U'); | |
SET result = REPLACE(result, 'ñ', 'n'); | |
SET result = REPLACE(result, 'Ñ', 'N'); | |
RETURN result; | |
END;; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment