mirror of
https://github.com/jbranchaud/til
synced 2026-01-03 15:18:01 +00:00
Add Capitalize All The Words as a postgres til
This commit is contained in:
@@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
|
||||
For a steady stream of TILs from a variety of rocketeers, checkout
|
||||
[til.hashrocket.com](https://til.hashrocket.com/).
|
||||
|
||||
_555 TILs and counting..._
|
||||
_556 TILs and counting..._
|
||||
|
||||
---
|
||||
|
||||
@@ -263,6 +263,7 @@ _555 TILs and counting..._
|
||||
- [Assumed Radius Of The Earth](postgres/assumed-radius-of-the-earth.md)
|
||||
- [Auto Expanded Display](postgres/auto-expanded-display.md)
|
||||
- [Between Symmetric](postgres/between-symmetric.md)
|
||||
- [Capitalize All The Words](postgres/capitalize-all-the-words.md)
|
||||
- [Change The Current Directory For psql](postgres/change-the-current-directory-for-psql.md)
|
||||
- [Checking Inequality](postgres/checking-inequality.md)
|
||||
- [Checking The Type Of A Value](postgres/checking-the-type-of-a-value.md)
|
||||
|
||||
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