The replace string function replaces a part of a string with another string. This function is case sensitive.
select replace('hello world', 'wor', '$$$');
Can you guess what the result of this would be?
Result: hello $$$rld
In the example above, we have replaced 'wor' with '$$$'.
The below screenshot uses replace on the "title" column in the books table and replaces all lower letter e's with the number 3
You can also combine the replace string function with other string functions:
select substring(replace(title, 'e', '3'),1,5) As weird_title from books;
The reverse string accepts one argument (the string to be reversed) and the reverses it.
select reverse('hello world');
Result is: dlrow olleh
That's the end of this article. Hope you found it useful!