File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 2828#include < span>
2929#include < stdexcept>
3030#include < string_view>
31+ #include < type_traits>
3132#include < vector>
3233
3334
@@ -553,6 +554,31 @@ namespace pcs // i.e. "pythonic c++ strings"
553554 }
554555
555556
557+ // --- join() ------------------------------------------
558+ /* * \brief Returns a string which is the concatenation of the strings in the parameters list.
559+ *
560+ * The separator between elements is the string to which this method is applied.
561+ */
562+ template <class ... NextCppStringsT>
563+ inline CppStringT join (const CppStringT& first, const NextCppStringsT... others) const noexcept
564+ requires (sizeof ...(others) > 0)
565+ {
566+ return first + *this + this ->join (others...);
567+ }
568+
569+ /* * \brief A single parameter signature. Returns a copy of this parameter. */
570+ inline const CppStringT join (const CppStringT& s) const noexcept
571+ {
572+ return s;
573+ }
574+
575+ /* * \brief Empty parameters list signature. Returns a copy of current string. */
576+ inline const CppStringT join () const noexcept
577+ {
578+ return *this ;
579+ }
580+
581+
556582 // --- lower () -----------------------------------------
557583 /* * \brief In-place replaces all characters of the string with their lowercase conversion. Returns a reference to string.
558584 *
You can’t perform that action at this time.
0 commit comments