PostgreSQL String Functions

This page provides comprehensive PostgreSQL string functions that help you effectively manipulate text data.

Section 1. Extracting Strings #

This section introduces the functions for extracting a substring from a string.

Section 2. Case Manipulation Functions #

This section shows how to convert a string to lowercase, uppercase, and initial caps.

  • LOWER(string) – Returns a new string with all characters in the input string converted to lowercase.
  • UPPER(string) – Returns a new string with all characters in the input string converted to uppercase.
  • INITCAP(string) – Return a new string with the letter of each word in the input string to uppercase and the remainder to lowercase.

Section 3. Finding Strings #

Section 4. Trimming Strings #

This section introduces various string trimming functions to remove specified characters from the start, end, or both ends of a string.

Section 5. Formatting Strings #

This section shows you how to pad a string on the left or right with specified characters.

Section 6. Replacing, Repeating, and Overlaying Functions #

Section 7. String Concatenation Functions #

Section 8. Regular Expression Functions #

Section 9. Length and Character Functions #

  • LENGTH(string) – Returns the number of characters in the string.
  • ASCII(string) – Returns the ASCII code of the first character of the string.
  • CHR(integer) – Returns the character corresponding to the given ASCII (or Unicode) code.
  • REVERSE(string) – Returns a new string with the characters of the input string are in reverse order.

Section 10. Quoting Functions #

Was this tutorial helpful ?