How to find the first and last occurrences of a specific character inside a string in PostgreSQL

Posted by Sayem Ahmed on Stack Overflow See other posts from Stack Overflow or by Sayem Ahmed
Published on 2010-06-03T11:56:15Z Indexed on 2010/06/03 12:54 UTC
Read the original article Hit count: 290

Filed under:
|

I want to find the first and the last occurrences of a specific character inside a string. As an example, consider a string named "2010-####-3434", and suppose the character to be searched for is "#". The first occurrence of hash inside the string is at 6-th position, and the last occurrence is at 9-th position.

© Stack Overflow or respective owner

Related posts about postgresql

Related posts about plpgsql