File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -150,6 +150,21 @@ class CppStringT : public std::basic_string<CharT>
150150 return n;
151151 }
152152
153+
154+ // --- count_n() ---------------------------------------
155+ /* * \brief Returns the number of non-overlapping occurrences of substring sub in the range [start, start+length-1]. */
156+ inline constexpr size_type count_n (const CppStringT& sub, const size_type start, const size_type length) const noexcept
157+ {
158+ return count (sub, start, start + length - 1 );
159+ }
160+
161+ /* * \brief Returns the number of non-overlapping occurrences of substring sub in the range [0, length-1]. */
162+ inline constexpr size_type count_n (const CppStringT& sub, const size_type length) const noexcept
163+ {
164+ return count (sub, 0 , length - 1 );
165+ }
166+
167+
153168 // --- find() ------------------------------------------
154169 /* * Returns the lowest index in the string where substring sub is found within the slice str[start:end], or -1 (i.e. 'npos') if sub is not found.
155170 *
You can’t perform that action at this time.
0 commit comments