Created
April 18, 2019 05:43
-
-
Save tobias-khs/72b2ba2893697c33ad17dd6403cef672 to your computer and use it in GitHub Desktop.
Katakana Character to Gyo (行) MySQL function/procedure. Han-/Dakuten map to Normal/Base
This file contains hidden or 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
| CREATE DEFINER=`root`@`localhost` FUNCTION `mydb`.`gyoize`(str VARCHAR(255)) RETURNS varchar(2) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci | |
| BEGIN | |
| DECLARE gyo VARCHAR(2); | |
| DECLARE kata VARCHAR(128); | |
| DECLARE gyos VARCHAR(128); | |
| DECLARE gyoPos INT; | |
| SET kata = 'アイウエオヴカキクケコガギグゲゴサシスセソザジズゼゾタチツテトダヂヅデドナニヌネノハヒフヘホバビブベボパピプペポマミムメモヤユヨラリルレロワヲン'; | |
| SET gyos = 'アアアアアアカカカカカカカカカカササササササササササタタタタタタタタタタナナナナナハハハハハハハハハハハハハハハマママママヤヤヤラララララワワワ'; | |
| SET gyo = SUBSTRING(str, 1, 1); | |
| SET gyoPos = POSITION(gyo IN kata); | |
| RETURN SUBSTRING(gyos, gyoPos, 1); | |
| END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment