@@ -388,6 +388,49 @@ class CppStringT : public std::basic_string<CharT>
388388 }
389389
390390
391+ // --- rindex() ----------------------------------------
392+ /* * Like rfind(sub, start, end), but raises NotFoundException when the substring is not found.
393+ *
394+ * \see index(), index_n() and rindex_n().
395+ * \see find(), find_n(), rfind() and rfind_n().
396+ */
397+ inline constexpr size_type rindex (const CppStringT& sub, const size_type start, const size_type end) const
398+ {
399+ const size_type ret_value = rfind (sub, start, end);
400+ if (size_type == CppStringT::npos)
401+ throw NotFoundException (std::format (" substring \" {}\" not found in string \" {}\" " , sub, this ->c_str ()));
402+ else
403+ return ret_value;
404+ }
405+
406+ /* * Like rfind(sub, start), but raises NotFoundException when the substring is not found.
407+ *
408+ * \see index(), index_n() and rindex_n().
409+ * \see find(), find_n(), rfind() and rfind_n().
410+ */
411+ inline constexpr size_type rindex (const CppStringT& sub, const size_type start) const
412+ {
413+ const size_type ret_value = rfind (sub, start);
414+ if (size_type == CppStringT::npos)
415+ throw NotFoundException (std::format (" substring \" {}\" not found in string \" {}\" " , sub, this ->c_str ()));
416+ else
417+ return ret_value;
418+ }
419+
420+ /* * Like rfind(sub), but raises NotFoundException when the substring is not found.
421+ *
422+ * \see index(), index_n() and rindex_n().
423+ * \see find(), find_n(), rfind() and rfind_n().
424+ */
425+ inline constexpr size_type rindex (const CppStringT& sub) const
426+ {
427+ const size_type ret_value = rfind (sub);
428+ if (size_type == CppStringT::npos)
429+ throw NotFoundException (std::format (" substring \" {}\" not found in string \" {}\" " , sub, this ->c_str ()));
430+ else
431+ return ret_value;
432+ }
433+
391434
392435 // --- upper () -----------------------------------------
393436 /* * \brief In-place replaces all characters of the string with their uppercase conversion. Returns a reference to string.
0 commit comments