Created
December 13, 2022 13:40
-
-
Save le0pard/7ecfadacccec11a98b791f47c8a6c7a8 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
create function lcfirst(word text) | |
returns text | |
language plpgsql | |
immutable | |
as $$ | |
begin | |
return lower(left(word, 1)) || right(word, -1); | |
end; | |
$$; | |
create function camel_case(snake_case text) | |
returns text | |
language plpgsql | |
immutable | |
as $$ | |
begin | |
return | |
replace( | |
initcap( | |
replace(snake_case, '_', ' ') | |
), | |
' ', '' | |
); | |
end; | |
$$; | |
select lcfirst(camel_case('snek_snek_snek')); | |
lcfirst | |
-------------- | |
snekSnekSnek |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment