Created
November 10, 2014 00:15
-
-
Save juntalis/14cb0a66b35b59acfe10 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
BEGIN | |
DECLARE c CHAR(1); | |
DECLARE s VARCHAR(128); | |
DECLARE i INT DEFAULT 1; | |
DECLARE bool INT DEFAULT 1; | |
DECLARE punct CHAR(17) DEFAULT ' ()[]{},.-_!@;:?/'; | |
SET s = LCASE( str ); | |
WHILE i <= LENGTH( str ) DO | |
BEGIN | |
SET c = SUBSTRING( s, i, 1 ); | |
IF LOCATE( c, punct ) > 0 THEN | |
SET bool = 1; | |
ELSEIF bool=1 THEN | |
BEGIN | |
IF c >= 'a' AND c <= 'z' THEN | |
BEGIN | |
SET s = CONCAT(LEFT(s,i-1),UCASE(c),SUBSTRING(s,i+1)); | |
SET bool = 0; | |
END; | |
ELSEIF c >= '0' AND c <= '9' THEN | |
SET bool = 0; | |
END IF; | |
END; | |
END IF; | |
SET i = i+1; | |
END; | |
END WHILE; | |
SET str = s; | |
SELECT s; | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment