Postgresql Initcap Function

PostgreSQL: initcap Function

In this PostgreSQL post explains how to use the PostgreSQL initcap function with syntax and examples.

Description

The PostgreSQL initcap function converts the first letter of each word to uppercase and all other letters are converted to lowercase.

Syntax

The syntax for the initcap function in PostgreSQL is:

initcap( string )

Parameters or Arguments

string

The string to convert.

Note

  • If there are characters in the string that are not letters, they are unaffected by the initcap function.
  • See also the upper and lower functions.

Applies To

The initcap function can be used in the following versions of PostgreSQL:

  • PostgreSQL 9.4, PostgreSQL 9.3, PostgreSQL 9.2, PostgreSQL 9.1, PostgreSQL 9.0, PostgreSQL 8.4

Example

Let's look at some PostgreSQL initcap function examples and explore how to use the initcap function in PostgreSQL.

For example:

postgres=# SELECT initcap('This is an example by AODBA.com.');
                 initcap
-----------------------------------------

 This Is An Example By AODBA.Com.
(1 row)

postgres=# SELECT initcap('Learn PostgreSQL with aodba.Com!');
                initcap
----------------------------------------

 Learn Postgresql With Aodba.Com!
(1 row)