mirror of
https://github.com/jbranchaud/til
synced 2026-01-18 06:28:02 +00:00
Add Capitalize All The Words as a postgres til
This commit is contained in:
23
postgres/capitalize-all-the-words.md
Normal file
23
postgres/capitalize-all-the-words.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# Capitalize All The Words
|
||||
|
||||
PostgreSQL provides the string function `initcap()` as a way of capitalizing
|
||||
all words. In the process, it cleans up the casing of the remaining parts of
|
||||
the words.
|
||||
|
||||
Here are some example of how it works.
|
||||
|
||||
```sql
|
||||
> select initcap('hello, world');
|
||||
initcap
|
||||
--------------
|
||||
Hello, World
|
||||
|
||||
> select initcap('HELLO, WORLD');
|
||||
initcap
|
||||
--------------
|
||||
Hello, World
|
||||
```
|
||||
|
||||
See the [String Functions and Operators
|
||||
docs](https://www.postgresql.org/docs/current/static/functions-string.html)
|
||||
for more details.
|
||||
Reference in New Issue
Block a user