Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 1F0801337B4E for ; Mon, 7 Mar 2011 17:20:30 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 50653-04 for ; Mon, 7 Mar 2011 21:20:23 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.techbaza.pl (unknown [84.205.162.156]) by mail.postgresql.org (Postfix) with SMTP id 2C66E1337B5D for ; Mon, 7 Mar 2011 17:20:21 -0400 (AST) Received: from [192.168.1.203] ([192.168.1.203]) by mail.techbaza.pl ; Mon, 7 Mar 2011 22:20:16 +0100 Message-ID: <4D754C0E.4030804@techbaza.pl> Date: Mon, 07 Mar 2011 22:20:14 +0100 From: Piotr Czekalski Organization: TECHBAZA.PL User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; pl; rv:1.9.2.12) Gecko/20101027 Thunderbird/3.1.6 ThunderBrowse/3.3.2 MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: A function to count all ocurrences of a character within a string. Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.107 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RDNS_NONE=0.793 X-Spam-Level: X-Archive-Number: 201103/11 X-Sequence-Number: 35213 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 -- -------------------------------------------------------------- "TECHBAZA.PL" Sp. z o.o. Technologie WEB, eDB& eCommerce tel. (+4832) 7186081 fax. (+4832) 7003289 email: biuro@techbaza.pl