@@ -640,12 +640,16 @@ namespace detail {
640640// Utilities:
641641//
642642
643+ // null character:
644+
643645template < typename CharT >
644646string_nodiscard string_constexpr CharT nullchr () noexcept
645647{
646648 return 0 ;
647649}
648650
651+ // null C-string:
652+
649653#if string_CONFIG_PROVIDE_CHAR_T
650654string_nodiscard string_constexpr char const * nullstr ( char ) noexcept
651655{
@@ -681,6 +685,45 @@ string_nodiscard string_constexpr char32_t const * nullstr( char32_t ) noexcept
681685}
682686#endif
683687
688+ // default strip set:
689+
690+ #if string_CONFIG_PROVIDE_CHAR_T
691+ string_nodiscard inline char const * default_strip_set ( char )
692+ {
693+ return " \t\n " ;
694+ }
695+ #endif
696+
697+ #if string_CONFIG_PROVIDE_WCHAR_T
698+ string_nodiscard string_constexpr wchar_t const * default_strip_set ( wchar_t ) noexcept
699+ {
700+ return L" \t\n " ;
701+ }
702+ #endif
703+
704+ #if string_CONFIG_PROVIDE_CHAR8_T
705+ string_nodiscard string_constexpr char8_t const * default_strip_set ( char8_t ) noexcept
706+ {
707+ return u8" \t\n " ;
708+ }
709+ #endif
710+
711+ #if string_CONFIG_PROVIDE_CHAR16_T
712+ string_nodiscard string_constexpr char16_t const * default_strip_set ( char16_t ) noexcept
713+ {
714+ return u" \t\n " ;
715+ }
716+ #endif
717+
718+ #if string_CONFIG_PROVIDE_CHAR32_T
719+ string_nodiscard string_constexpr char32_t const * default_strip_set ( char32_t ) noexcept
720+ {
721+ return U" \t\n " ;
722+ }
723+ #endif
724+
725+ // to_string(sv):
726+
684727#if string_HAVE_STRING_VIEW
685728 #define MK_DETAIL_TO_STRING_SV (T ) \
686729 string_nodiscard inline std::basic_string<T> \
@@ -1143,7 +1186,7 @@ string_nodiscard std::basic_string<CharT> to_case( std::basic_string<CharT> text
11431186 return result; \
11441187 }
11451188
1146- // to_lowercase(), to_uppercase():
1189+ // to_lowercase(), to_uppercase()
11471190
11481191// template string_nodiscard std::basic_string<CharT> to_lowercase( std17::basic_string_view<CharT> text ) string_noexcept;
11491192
@@ -1159,40 +1202,37 @@ string_nodiscard std::basic_string<CharT> to_case( std::basic_string<CharT> text
11591202 return detail::to_case ( std::basic_string<CharT>(text), detail::to_ ## Function<CharT> ); \
11601203 }
11611204
1162- // template< typename StringT >
1163- // inline StringT const default_strip_set()
1164- // {
1165- // return " \t\n";
1166- // }
1167-
11681205// strip_left()
11691206
11701207#define string_MK_STRIP_LEFT (CharT ) \
1171- template < typename SetT > \
1172- string_nodiscard std::basic_string<CharT> \
1173- strip_left ( std17::basic_string_view<CharT> text, SetT const & set ) \
1208+ string_nodiscard inline std::basic_string<CharT> \
1209+ strip_left ( \
1210+ std17::basic_string_view<CharT> text \
1211+ , std17::basic_string_view<CharT> set = detail::default_strip_set(CharT{}) ) \
11741212 { \
11751213 return std::basic_string<CharT>( text ).erase ( 0 , text.find_first_not_of ( set ) ); \
11761214 }
11771215
11781216// strip_right()
11791217
11801218#define string_MK_STRIP_RIGHT (CharT ) \
1181- template < typename SetT > \
1182- string_nodiscard std::basic_string<CharT> \
1183- strip_right ( std17::basic_string_view<CharT> text, SetT const & set ) \
1219+ string_nodiscard inline std::basic_string<CharT> \
1220+ strip_right ( \
1221+ std17::basic_string_view<CharT> text \
1222+ , std17::basic_string_view<CharT> set = detail::default_strip_set(CharT{}) ) \
11841223 { \
11851224 return std::basic_string<CharT>( text ).erase ( text.find_last_not_of ( set ) + 1 ); \
11861225 }
11871226
11881227// strip()
11891228
1190- #define string_MK_STRIP (CharT ) \
1191- template < typename SetT > \
1192- string_nodiscard std::basic_string<CharT> \
1193- strip ( std17::basic_string_view<CharT> text, SetT const & set ) \
1194- { \
1195- return strip_left ( strip_right ( text, set ), set ); \
1229+ #define string_MK_STRIP (CharT ) \
1230+ string_nodiscard inline std::basic_string<CharT> \
1231+ strip ( \
1232+ std17::basic_string_view<CharT> text \
1233+ , std17::basic_string_view<CharT> set = detail::default_strip_set(CharT{}) ) \
1234+ { \
1235+ return strip_left ( strip_right ( text, set ), set ); \
11961236 }
11971237
11981238// erase_all()
0 commit comments