mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-11 08:52:06 +00:00
838596c7a4
Function to count number of substring occurrences in the string: - in case of needle is multi char - counts non-intersecting substrings - the code is based on position helpers. The following new functions is available: - countSubstrings() - countSubstringsCaseInsensitive() - countSubstringsCaseInsensitiveUTF8() v0: substringCount() v2: - add substringCountCaseInsensitiveUTF8 - improve tests - fix coding style issues - fix multichar needle v3: rename to countSubstrings (by analogy with countEqual())
25 lines
560 B
C++
25 lines
560 B
C++
#include "FunctionsStringSearch.h"
|
|
#include "FunctionFactory.h"
|
|
#include "CountSubstringsImpl.h"
|
|
|
|
|
|
namespace DB
|
|
{
|
|
namespace
|
|
{
|
|
|
|
struct NameCountSubstringsCaseInsensitive
|
|
{
|
|
static constexpr auto name = "countSubstringsCaseInsensitive";
|
|
};
|
|
|
|
using FunctionCountSubstringsCaseInsensitive = FunctionsStringSearch<CountSubstringsImpl<PositionCaseInsensitiveASCII>, NameCountSubstringsCaseInsensitive>;
|
|
|
|
}
|
|
|
|
void registerFunctionCountSubstringsCaseInsensitive(FunctionFactory & factory)
|
|
{
|
|
factory.registerFunction<FunctionCountSubstringsCaseInsensitive>();
|
|
}
|
|
}
|