Skip to content

Commit e986ede

Browse files
committed
#18-Implement method CppStringT::format()
Completed. Not that immediate. Still to be tested.
1 parent b3dc949 commit e986ede

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

cpp-strings/cppstrings.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,15 @@ namespace pcs // i.e. "pythonic c++ strings"
723723
}
724724

725725

726+
//--- format() ----------------------------------------
727+
/** Formats this string according to c++20 std::format() specification. Returns it (may be discarded). */
728+
template<class... ArgsT>
729+
inline CppStringT format(const std::format_string<ArgsT...> frmt, ArgsT&&... args)
730+
{
731+
return *this = std::vformat(frmt.get(), std::make_format_args(args...));
732+
}
733+
734+
726735
//--- index() -----------------------------------------
727736
/** Like find(const CppStringT&), but raises NotFoundException when the substring sub is not found.
728737
*

0 commit comments

Comments
 (0)