In this PostgreSQL post explains how to use the PostgreSQL strpos function with syntax and examples.
The PostgreSQL strpos function returns the location of a substring in a string.
The syntax for the strpos function in PostgreSQL is:
strpos( string, substring )
The string to search.
The substring to search for in string.
The strpos function can be used in the following versions of PostgreSQL:
Let's look at some PostgreSQL strpos function examples and explore how to use the strpos function in PostgreSQL.
For example:
postgres=# SELECT strpos('Titan', 'T');
strpos
--------
1
(1 row)
postgres=# SELECT strpos('Titan', 't');
strpos
--------
3
(1 row)
postgres=# SELECT strpos('AODBA.com', 'B');
strpos
--------
4
(1 row)
postgres=# SELECT strpos('AODBA.com', 'Z');
strpos
--------
0
(1 row)