String function to Find how many times str2 is in str1? - Mailing list pgsql-sql

From Emi Lu
Subject String function to Find how many times str2 is in str1?
Date
Msg-id 47B5B944.4010203@encs.concordia.ca
Whole thread Raw
Responses Re: String function to Find how many times str2 is in str1?  ("Rodrigo E. De León Plicet" <rdeleonp@gmail.com>)
List pgsql-sql
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




pgsql-sql by date:

Previous
From: "Bart Degryse"
Date:
Subject: Re: Function description
Next
From: "Rodrigo E. De León Plicet"
Date:
Subject: Re: String function to Find how many times str2 is in str1?