Skip to content

Commit 8a666e5

Browse files
committed
#67 - Fix methods index() and index_n()
Completed.
1 parent 895404b commit 8a666e5

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

cpp-strings/cppstrings.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -249,23 +249,22 @@ class CppStringT : public std::basic_string<CharT>
249249
* \see index_n(), rindex() and rindex_n().
250250
* \see find(), find_n(), rfind() and rfind_n().
251251
*/
252-
inline constexpr size_type index_n(const CppStringT& sub, const size_type start, const size_type length) const
252+
inline constexpr size_type index_n(const CppStringT& sub, const size_type start, const size_type count) const
253253
{
254-
return index_n(sub, start, start + length - 1);
254+
return index(sub, start, start + count - 1);
255255
}
256256

257257
/** Like find_n(sub, start), but raises NotFoundException when the substring is not found.
258258
*
259259
* \see index_n(), rindex() and rindex_n().
260260
* \see find(), find_n(), rfind() and rfind_n().
261261
*/
262-
inline constexpr size_type index_n(const CppStringT& sub, const size_type length) const
262+
inline constexpr size_type index_n(const CppStringT& sub, const size_type count) const
263263
{
264-
return index_n(sub, 0, length - 1);
264+
return index(sub, 0, count - 1);
265265
}
266266

267267

268-
269268
//--- is_punctuation() --------------------------------
270269
/** \brief Returns true if the string contains only one character and if this character belongs to the ASCII punctuation set. */
271270
inline const bool is_punctuation() const noexcept

0 commit comments

Comments
 (0)