3template<
typename TChar, lang::Case TSensitivity>
6template<
typename TChar, lang::Case TSensitivity>
29 if (needleIdx ==
needle.Length())
38template<
typename TChar, lang::Case TSensitivity>
43 if ( haystackIdx < 0 ) haystackIdx= 0;
44 if ( haystackIdx +
needle.Length() > haystack.
Length() )
return -1;
50 while (haystackIdx != haystack.
Length()) {
52 needle .Buffer()[needleIdx] ) )
56 if ( needleIdx >=
needle.Length() )
57 return (haystackIdx - needleIdx);
constexpr integer Length() const
constexpr const TChar * Buffer() const
constexpr bool IsNull() const
~TStringSearch()
Destructor.
TStringSearch(const TString< TChar > &pNeedle=nullptr)
TAString< TChar, lang::HeapAllocator > needle
The needle set Knuth-Morris-Pratt prefix length table.
integer kmpTableLength
Length of #"kmpTable".
void Compile(const TString< TChar > &needle)
integer Search(const TString< TChar > &haystack, integer startIdx=0)
integer * kmpTable
The Knuth-Morris-Pratt prefix length table.
bool Equal(TChar lhs, TRhs rhs)
lang::integer integer
Type alias in namespace #"%alib".