From: bricklen <bricklen@gmail.com>
To: Piotr Czekalski <pczekalski@techbaza.pl>
Cc: pgsql-sql@postgresql.org
Subject: Re: A function to count all ocurrences of a character within a string.
Date: Mon, 7 Mar 2011 14:08:10 -0800
Message-ID: <AANLkTimkG6PrtaS7MQ8qxEuMRLFre6ZxOXtgfApb+OgE@mail.gmail.com> (raw)
In-Reply-To: <4D754C0E.4030804@techbaza.pl>
References: <4D754C0E.4030804@techbaza.pl>
On Mon, Mar 7, 2011 at 1:20 PM, Piotr Czekalski <pczekalski@techbaza.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: bricklen@gmail.com, pczekalski@techbaza.pl
Subject: Re: A function to count all ocurrences of a character within a string.
In-Reply-To: <AANLkTimkG6PrtaS7MQ8qxEuMRLFre6ZxOXtgfApb+OgE@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox