PostgreSQL initcap() Function
The PostgreSQL initcap()
function converts the first letter of each word in the gaven string to uppercase and the rest to lowercase.
initcap()
Syntax
This is the syntax of the PostgreSQL initcap()
function:
initcap(str)
Parameters
str
-
Required. The string that will be converted as a caption.
Return value
The PostgreSQL initcap()
function converts the first letter of each word in the specified string to uppercase, and other letters to lowercase, and returns the converted string.
Note: A word is a sequence of letters and numbers.
If the parameter is NULL
, the function will return NULL
.
initcap()
Examples
This example shows how to use the initcap()
function to convert the given string into title case.
SELECT initcap('hello world') AS "initcap('hello world')";
initcap('hello world')
------------------------
Hello World