Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id DD6442E0033 for ; Fri, 15 Feb 2008 12:09:45 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 44463-05 for ; Fri, 15 Feb 2008 12:09:43 -0400 (AST) Received: from perseverance.services.encs.concordia.ca (perseverance-96.encs.concordia.ca [132.205.96.94]) by postgresql.org (Postfix) with ESMTP id A8E002E0031 for ; Fri, 15 Feb 2008 12:09:42 -0400 (AST) Received: from cacao.encs.concordia.ca (emilu@cacao.encs.concordia.ca [132.205.47.225]) by perseverance.services.encs.concordia.ca (envelope-from emilu@encs.concordia.ca) (8.13.7/8.13.7) with ESMTP id m1FG9eIp018866 for ; Fri, 15 Feb 2008 11:09:41 -0500 Message-ID: <47B5B944.4010203@encs.concordia.ca> Date: Fri, 15 Feb 2008 11:09:40 -0500 From: Emi Lu Reply-To: emilu@encs.concordia.ca User-Agent: Thunderbird 2.0.0.6 (X11/20070728) MIME-Version: 1.0 To: PostgreSQL SQL List Subject: String function to Find how many times str2 is in str1? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.58 on perseverance.encs.concordia.ca at 2008/02/15 11:09:41 EST X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200802/129 X-Sequence-Number: 30220 Good morning, Is there a string function in PSQL to count how many times one str is in another string? For example, Str1 = "test test caa dtest testing EndofString"; Str2 = " "; select funcName(Str1, Str2); return 5 Because Str1 has 5 Str2. Thanks ! Ly