Re: A function to count all ocurrences of a character within a string.

From: bricklen <bricklen(at)gmail(dot)com>
To: Piotr Czekalski <pczekalski(at)techbaza(dot)pl>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: A function to count all ocurrences of a character within a string.
Date: 2011-03-07 22:08:10
Message-ID: AANLkTimkG6PrtaS7MQ8qxEuMRLFre6ZxOXtgfApb+OgE@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Mon, Mar 7, 2011 at 1:20 PM, Piotr Czekalski <pczekalski(at)techbaza(dot)pl> wrote:
> Hello pgsql community,
>
> Is there any string function (other than regex / scan & compare loop) to
> obtain a list (or even a count) of characters within a string?
> strpos and position seems to return only first occurence of a char/string
> within substring.
> The goal is to check if a string contains equal number of opening and
> closing parenthesis, and if there are any of them.
>
> Regards,
>
> Piotr Czekalski

Couple examples here that might help to get you started
http://www.postgres.cz/index.php/PostgreSQL_SQL_Tricks#Get_count_of_substrings_in_string

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Ross J. Reedstrom 2011-03-07 22:32:41 Re: A function to count all ocurrences of a character within a string.
Previous Message Piotr Czekalski 2011-03-07 21:20:14 A function to count all ocurrences of a character within a string.