\hypertarget{stringops_8h_source}{}\doxysection{stringops.\+h} \label{stringops_8h_source}\index{kblib/stringops.h@{kblib/stringops.h}} \mbox{\hyperlink{stringops_8h}{Go to the documentation of this file.}} \begin{DoxyCode}{0} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00001}00001 \textcolor{comment}{/* *****************************************************************************}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00002}00002 \textcolor{comment}{ * kblib is a general utility library for C++14 and C++17, intended to provide}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00003}00003 \textcolor{comment}{ * performant high-\/level abstractions and more expressive ways to do simple}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00004}00004 \textcolor{comment}{ * things.}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00005}00005 \textcolor{comment}{ *}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00006}00006 \textcolor{comment}{ * Copyright (c) 2021 killerbee}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00007}00007 \textcolor{comment}{ *}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00008}00008 \textcolor{comment}{ * This program is free software: you can redistribute it and/or modify}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00009}00009 \textcolor{comment}{ * it under the terms of the GNU General Public License as published by}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00010}00010 \textcolor{comment}{ * the Free Software Foundation, either version 3 of the License, or}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00011}00011 \textcolor{comment}{ * (at your option) any later version.}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00012}00012 \textcolor{comment}{ *}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00013}00013 \textcolor{comment}{ * This program is distributed in the hope that it will be useful,}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00014}00014 \textcolor{comment}{ * but WITHOUT ANY WARRANTY; without even the implied warranty of}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00015}00015 \textcolor{comment}{ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00016}00016 \textcolor{comment}{ * GNU General Public License for more details.}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00017}00017 \textcolor{comment}{ *}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00018}00018 \textcolor{comment}{ * You should have received a copy of the GNU General Public License}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00019}00019 \textcolor{comment}{ * along with this program. If not, see .}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00020}00020 \textcolor{comment}{ * ****************************************************************************/}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00021}00021 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00031}00031 \textcolor{preprocessor}{\#ifndef KBLIB\_STRINGOPS\_H}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00032}00032 \textcolor{preprocessor}{\#define KBLIB\_STRINGOPS\_H}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00033}00033 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00034}00034 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{algorithm_8h}{algorithm.h}}"{}}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00035}00035 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{format_8h}{format.h}}"{}}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00036}00036 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{tdecl_8h}{tdecl.h}}"{}}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00037}00037 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{traits_8h}{traits.h}}"{}}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00038}00038 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00039}00039 \textcolor{preprocessor}{\#include }} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00040}00040 \textcolor{preprocessor}{\#include }} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00041}00041 \textcolor{preprocessor}{\#include }} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00042}00042 \textcolor{preprocessor}{\#include }} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00043}00043 \textcolor{preprocessor}{\#include }} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00044}00044 \textcolor{preprocessor}{\#include }} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00045}00045 \textcolor{preprocessor}{\#include }} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00046}00046 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00047}00047 \textcolor{preprocessor}{\#if KBLIB\_USE\_CXX17}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00048}00048 \textcolor{preprocessor}{\# include }} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00049}00049 \textcolor{preprocessor}{\#endif}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00050}00050 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00051}00051 \textcolor{keyword}{namespace }\mbox{\hyperlink{tdecl_8h_a4b5c574c663a392148218cd4410fd7a1}{KBLIB\_NS}} \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00052}00052 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00053}00053 \textcolor{preprocessor}{\#if true or KBLIB\_USE\_CXX17}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00061}00061 \textcolor{keyword}{template} <\textcolor{keyword}{typename} C>} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00062}\mbox{\hyperlink{structkblib_1_1is__character}{00062}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1is__character}{is\_character}}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00063}00063 : \mbox{\hyperlink{structkblib_1_1contains__type}{contains\_type}},} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00069}00069 std::decay\_t> \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00070}00070 \};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00071}00071 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00075}00075 \textcolor{keyword}{template} <\textcolor{keyword}{typename} C>} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00076}\mbox{\hyperlink{namespacekblib_a7161c2976d0e6426ae3a6fdd0d40bc54}{00076}} \textcolor{keyword}{constexpr} \textcolor{keywordtype}{bool} \mbox{\hyperlink{namespacekblib_a7161c2976d0e6426ae3a6fdd0d40bc54}{is\_character\_v}} = \mbox{\hyperlink{structkblib_1_1is__character}{is\_character::value}};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00077}00077 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00078}00078 \textcolor{keyword}{namespace }detail \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00079}00079 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00086}00086 template ::value>} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00087}\mbox{\hyperlink{structkblib_1_1detail_1_1arithmetic__type}{00087}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1detail_1_1arithmetic__type}{arithmetic\_type}} \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00088}\mbox{\hyperlink{structkblib_1_1detail_1_1arithmetic__type_a691889e4ec8c53a00e428f5382f45b94}{00088}} \textcolor{keyword}{using }\mbox{\hyperlink{structkblib_1_1detail_1_1arithmetic__type_a691889e4ec8c53a00e428f5382f45b94}{type}} = void;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00089}00089 \};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00096}00096 \textcolor{keyword}{template} <\textcolor{keyword}{typename} T>} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00097}\mbox{\hyperlink{structkblib_1_1detail_1_1arithmetic__type_3_01_t_00_01true_01_4}{00097}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1detail_1_1arithmetic__type}{arithmetic\_type}} \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00098}\mbox{\hyperlink{structkblib_1_1detail_1_1arithmetic__type_3_01_t_00_01true_01_4_ac41b0bf7a732ad7f17adca393fe5ac71}{00098}} \textcolor{keyword}{using }\mbox{\hyperlink{structkblib_1_1detail_1_1arithmetic__type_3_01_t_00_01true_01_4_ac41b0bf7a732ad7f17adca393fe5ac71}{type}} = T;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00099}00099 \};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00103}00103 \textcolor{keyword}{template} <\textcolor{keyword}{typename} T>} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00104}\mbox{\hyperlink{namespacekblib_1_1detail_a648ea881d24251358900553878900cf8}{00104}} \textcolor{keyword}{using }\mbox{\hyperlink{namespacekblib_1_1detail_a648ea881d24251358900553878900cf8}{arithmetic\_type\_t}} = \textcolor{keyword}{typename} \mbox{\hyperlink{structkblib_1_1detail_1_1arithmetic__type_a691889e4ec8c53a00e428f5382f45b94}{arithmetic\_type::type}};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00105}00105 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00113}00113 \textcolor{keyword}{template} <\textcolor{keyword}{typename} T, \textcolor{keyword}{typename} = arithmetic\_type\_t>} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00114}\mbox{\hyperlink{structkblib_1_1detail_1_1str__type}{00114}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1detail_1_1str__type}{str\_type}} \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00119}\mbox{\hyperlink{structkblib_1_1detail_1_1str__type_a5e6a7abdec42c52a7fc542fdc68208e0}{00119}} \textcolor{keyword}{using }\mbox{\hyperlink{structkblib_1_1detail_1_1str__type_a5e6a7abdec42c52a7fc542fdc68208e0}{type}} = std::string;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00125}\mbox{\hyperlink{structkblib_1_1detail_1_1str__type_a8abc45ad7a5e17e326134453b8906017}{00125}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{static} \textcolor{keyword}{auto} \mbox{\hyperlink{structkblib_1_1detail_1_1str__type_a8abc45ad7a5e17e326134453b8906017}{convert}}(T in) -\/> std::string \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00126}00126 \textcolor{keywordflow}{return} \mbox{\hyperlink{namespacekblib_a9d7e23caee89855a71fb84c7f245f977}{std::to\_string}}(in);} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00127}00127 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00128}00128 \};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00140}00140 \textcolor{keyword}{template} <\textcolor{keyword}{typename} T>} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00141}\mbox{\hyperlink{structkblib_1_1detail_1_1str__type_3_01_t_00_01void_01_4}{00141}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1detail_1_1str__type}{str\_type}} \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00146}\mbox{\hyperlink{structkblib_1_1detail_1_1str__type_3_01_t_00_01void_01_4_aeb2d289e3da20479f6fed50679c73ae2}{00146}} \textcolor{keyword}{using }\mbox{\hyperlink{structkblib_1_1detail_1_1str__type_3_01_t_00_01void_01_4_aeb2d289e3da20479f6fed50679c73ae2}{type}} = T;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00150}\mbox{\hyperlink{structkblib_1_1detail_1_1str__type_3_01_t_00_01void_01_4_a24e0af82543da775597a1589c15ef988}{00150}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{static} \textcolor{keyword}{auto} \mbox{\hyperlink{structkblib_1_1detail_1_1str__type_3_01_t_00_01void_01_4_a24e0af82543da775597a1589c15ef988}{convert}}(T\&\& in) -\/> \mbox{\hyperlink{structkblib_1_1detail_1_1str__type_3_01_t_00_01void_01_4_aeb2d289e3da20479f6fed50679c73ae2}{type}} \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00151}00151 \textcolor{keywordflow}{return} std::forward(in);} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00152}00152 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00153}00153 \};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00157}00157 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00158}\mbox{\hyperlink{structkblib_1_1detail_1_1str__type_3_01char_00_01char_01_4}{00158}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1detail_1_1str__type}{str\_type}} \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00159}\mbox{\hyperlink{structkblib_1_1detail_1_1str__type_3_01char_00_01char_01_4_a15d90cdef91792a7cebdd991df1cf72f}{00159}} \textcolor{keyword}{using }\mbox{\hyperlink{structkblib_1_1detail_1_1str__type_3_01char_00_01char_01_4_a15d90cdef91792a7cebdd991df1cf72f}{type}} = char;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00160}\mbox{\hyperlink{structkblib_1_1detail_1_1str__type_3_01char_00_01char_01_4_ac65873d43bebde837c0c00a9b006a744}{00160}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{static} \textcolor{keyword}{auto} \mbox{\hyperlink{structkblib_1_1detail_1_1str__type_3_01char_00_01char_01_4_ac65873d43bebde837c0c00a9b006a744}{convert}}(\textcolor{keywordtype}{char} in) -\/> \textcolor{keywordtype}{char} \{ \textcolor{keywordflow}{return} in; \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00161}00161 \};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00165}00165 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00166}\mbox{\hyperlink{structkblib_1_1detail_1_1str__type_3_01wchar__t_00_01wchar__t_01_4}{00166}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1detail_1_1str__type}{str\_type}} \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00167}\mbox{\hyperlink{structkblib_1_1detail_1_1str__type_3_01wchar__t_00_01wchar__t_01_4_a996b196c4a17ce0953f5ca6731932bf2}{00167}} \textcolor{keyword}{using }\mbox{\hyperlink{structkblib_1_1detail_1_1str__type_3_01wchar__t_00_01wchar__t_01_4_a996b196c4a17ce0953f5ca6731932bf2}{type}} = wchar\_t;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00168}\mbox{\hyperlink{structkblib_1_1detail_1_1str__type_3_01wchar__t_00_01wchar__t_01_4_a7533a7efb8c281864554cbceb55618c8}{00168}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{static} \textcolor{keyword}{auto} \mbox{\hyperlink{structkblib_1_1detail_1_1str__type_3_01wchar__t_00_01wchar__t_01_4_a7533a7efb8c281864554cbceb55618c8}{convert}}(\textcolor{keywordtype}{wchar\_t} in) -\/> \textcolor{keywordtype}{wchar\_t} \{ \textcolor{keywordflow}{return} in; \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00169}00169 \};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00173}00173 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00174}\mbox{\hyperlink{structkblib_1_1detail_1_1str__type_3_01char16__t_00_01char16__t_01_4}{00174}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1detail_1_1str__type}{str\_type}} \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00175}\mbox{\hyperlink{structkblib_1_1detail_1_1str__type_3_01char16__t_00_01char16__t_01_4_a095a7e6c4f22682c8fc1b53b6c5cb925}{00175}} \textcolor{keyword}{using }\mbox{\hyperlink{structkblib_1_1detail_1_1str__type_3_01char16__t_00_01char16__t_01_4_a095a7e6c4f22682c8fc1b53b6c5cb925}{type}} = char16\_t;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00176}\mbox{\hyperlink{structkblib_1_1detail_1_1str__type_3_01char16__t_00_01char16__t_01_4_a85c6875f6910b7dab8633ed9f3087657}{00176}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{static} \textcolor{keyword}{auto} \mbox{\hyperlink{structkblib_1_1detail_1_1str__type_3_01char16__t_00_01char16__t_01_4_a85c6875f6910b7dab8633ed9f3087657}{convert}}(\textcolor{keywordtype}{char16\_t} in) -\/> \textcolor{keywordtype}{char16\_t} \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00177}00177 \textcolor{keywordflow}{return} in;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00178}00178 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00179}00179 \};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00183}00183 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00184}\mbox{\hyperlink{structkblib_1_1detail_1_1str__type_3_01char32__t_00_01char32__t_01_4}{00184}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1detail_1_1str__type}{str\_type}} \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00185}\mbox{\hyperlink{structkblib_1_1detail_1_1str__type_3_01char32__t_00_01char32__t_01_4_ab4e30bfcc9404ad7c8eca1ac0cd2b5df}{00185}} \textcolor{keyword}{using }\mbox{\hyperlink{structkblib_1_1detail_1_1str__type_3_01char32__t_00_01char32__t_01_4_ab4e30bfcc9404ad7c8eca1ac0cd2b5df}{type}} = char32\_t;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00186}\mbox{\hyperlink{structkblib_1_1detail_1_1str__type_3_01char32__t_00_01char32__t_01_4_a32e1b1e3ba7f1c1606911192ccfda4d8}{00186}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{static} \textcolor{keyword}{auto} \mbox{\hyperlink{structkblib_1_1detail_1_1str__type_3_01char32__t_00_01char32__t_01_4_a32e1b1e3ba7f1c1606911192ccfda4d8}{convert}}(\textcolor{keywordtype}{char32\_t} in) -\/> \textcolor{keywordtype}{char32\_t} \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00187}00187 \textcolor{keywordflow}{return} in;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00188}00188 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00189}00189 \};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00190}00190 \textcolor{preprocessor}{\# if \_\_cpp\_char8\_t}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00194}00194 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00195}00195 \textcolor{keyword}{struct }str\_type \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00196}00196 \textcolor{keyword}{using }type = char8\_t;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00197}00197 \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{static} \textcolor{keyword}{auto} convert(\textcolor{keywordtype}{char8\_t} in) -\/> \textcolor{keywordtype}{char8\_t} \{ \textcolor{keywordflow}{return} in; \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00198}00198 \};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00199}00199 \textcolor{preprocessor}{\# endif}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00203}00203 \textcolor{keyword}{template} <\textcolor{keyword}{typename} T>} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00204}\mbox{\hyperlink{namespacekblib_1_1detail_a60fec688ea68a688f870726b652cf69f}{00204}} \textcolor{keyword}{using }\mbox{\hyperlink{namespacekblib_1_1detail_a60fec688ea68a688f870726b652cf69f}{str\_type\_t}} = \textcolor{keyword}{typename} \mbox{\hyperlink{structkblib_1_1detail_1_1str__type_a5e6a7abdec42c52a7fc542fdc68208e0}{str\_type::type}};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00205}00205 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00206}00206 \} \textcolor{comment}{// namespace detail}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00207}00207 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00208}00208 \textcolor{preprocessor}{\# if KBLIB\_USE\_CXX17}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00216}00216 \textcolor{keyword}{template} <\textcolor{keyword}{typename} Str>} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00217}\mbox{\hyperlink{namespacekblib_a2fdc3a299b0c7c4d8432c253ad3bb1ca}{00217}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a2fdc3a299b0c7c4d8432c253ad3bb1ca}{strsize}}(Str\&\& str) -\/> std::size\_t \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00218}00218 \textcolor{keywordflow}{if} \textcolor{keyword}{constexpr} (std::is\_array\_v>) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00219}00219 \textcolor{keywordflow}{return} \mbox{\hyperlink{namespacekblib_1_1fakestd_adb8781bc0e5d1ba4ca4624293c0c98ae}{fakestd::size}}(str);} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00220}00220 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} \textcolor{keyword}{constexpr} (std::is\_pointer\_v>) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00221}00221 \textcolor{keywordflow}{return} std::char\_traits<\mbox{\hyperlink{namespacekblib_a9dcf2233bc360ff26fbbf82d98cdc64d}{std::decay\_t}}<\textcolor{keyword}{decltype}(*str)>>\mbox{\hyperlink{namespacekblib_a793fd30664717fe1da593bf53e895e9d}{::length}}(str);} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00222}00222 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} \textcolor{keyword}{constexpr} (is\_character\_v>) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00223}00223 \textcolor{keywordflow}{return} 1;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00224}00224 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} \textcolor{keyword}{constexpr} (std::is\_integral\_v>) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00225}00225 \textcolor{keywordflow}{return} \mbox{\hyperlink{namespacekblib_af9e250fffa2922e623baa08aa8994f54}{to\_unsigned}}(\mbox{\hyperlink{namespacekblib_ab5e75c9314c76b12efd507259206a546}{count\_digits}}(str));} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00226}00226 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} \textcolor{keyword}{constexpr} (std::is\_floating\_point\_v>) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00227}00227 \textcolor{keywordflow}{return} \mbox{\hyperlink{namespacekblib_af9e250fffa2922e623baa08aa8994f54}{to\_unsigned}}(\mbox{\hyperlink{namespacekblib_ab5e75c9314c76b12efd507259206a546}{count\_digits}}(str));} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00228}00228 \} \textcolor{keywordflow}{else} \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00229}00229 \textcolor{keywordflow}{return} \mbox{\hyperlink{namespacekblib_1_1fakestd_adb8781bc0e5d1ba4ca4624293c0c98ae}{fakestd::size}}(str);} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00230}00230 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00231}00231 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00232}00232 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00233}00233 \textcolor{keyword}{template} <\textcolor{keyword}{typename} CharT>} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00234}\mbox{\hyperlink{namespacekblib_a793fd30664717fe1da593bf53e895e9d}{00234}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a793fd30664717fe1da593bf53e895e9d}{length}}(\textcolor{keyword}{const} CharT* str) \textcolor{keyword}{noexcept}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00235}00235 -\/> std::size\_t \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00236}00236 \textcolor{keywordflow}{return} \mbox{\hyperlink{namespacekblib_a793fd30664717fe1da593bf53e895e9d}{std::char\_traits::length}}(str);} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00237}00237 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00238}00238 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00250}00250 \textcolor{keyword}{template} <\textcolor{keyword}{typename} string, \textcolor{keyword}{typename} F, \textcolor{keyword}{typename}... S>} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00251}\mbox{\hyperlink{namespacekblib_ab4642bf06f44ec657126cea9a3272f1c}{00251}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_ab4642bf06f44ec657126cea9a3272f1c}{append}}(\textcolor{keywordtype}{string}\&\& out, F\&\& f, S\&\&... tail) -\/> \textcolor{keywordtype}{void} \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00252}00252 \textcolor{keywordflow}{if} \textcolor{keyword}{constexpr} (is\_character\_v>) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00253}00253 out.append(1, f);} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00254}00254 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} \textcolor{keyword}{constexpr} (std::is\_arithmetic\_v>) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00255}00255 out.append(\mbox{\hyperlink{namespacekblib_a9d7e23caee89855a71fb84c7f245f977}{std::to\_string}}(f));} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00256}00256 \} \textcolor{keywordflow}{else} \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00257}00257 out.append(f);} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00258}00258 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00259}00259 \textcolor{keywordflow}{if} \textcolor{keyword}{constexpr} (\textcolor{keyword}{sizeof}...(S) > 0) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00260}00260 \mbox{\hyperlink{namespacekblib_ab4642bf06f44ec657126cea9a3272f1c}{append}}(out, tail...);} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00261}00261 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00262}00262 \textcolor{keywordflow}{return};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00263}00263 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00264}00264 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00265}00265 \textcolor{keyword}{namespace }detail \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00266}00266 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00267}00267 \textcolor{keyword}{template} } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00268}\mbox{\hyperlink{structkblib_1_1detail_1_1value}{00268}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1detail_1_1value}{value}} \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00269}\mbox{\hyperlink{structkblib_1_1detail_1_1value_a27e0c03dbe247638229858f0d112e470}{00269}} T \mbox{\hyperlink{structkblib_1_1detail_1_1value_a27e0c03dbe247638229858f0d112e470}{v}};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00270}00270 \};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00271}00271 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00272}00272 \textcolor{keyword}{template} <\textcolor{keyword}{class }Idxs, \textcolor{keyword}{class}... Ts>} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00273}\mbox{\hyperlink{structkblib_1_1detail_1_1values}{00273}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1detail_1_1values}{values}};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00274}00274 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00275}00275 \textcolor{keyword}{template} } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00276}\mbox{\hyperlink{structkblib_1_1detail_1_1values_3_01std_1_1index__sequence_3_01_idxs_8_8_8_01_4_00_01_ts_8_8_8_01_4}{00276}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1detail_1_1values}{values}}<\mbox{\hyperlink{namespacestd}{std}}::index\_sequence, Ts...> : \mbox{\hyperlink{structkblib_1_1detail_1_1value}{value}}... \{\};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00277}00277 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00278}00278 \textcolor{keyword}{template} <\textcolor{keyword}{typename} string, \textcolor{keyword}{typename}... S, std::size\_t... I>} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00279}\mbox{\hyperlink{namespacekblib_1_1detail_a99e8609e0af635b31b30ac17a57456a7}{00279}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail_a99e8609e0af635b31b30ac17a57456a7}{concat\_impl}}(std::index\_sequence, S\&\&... ins)} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00280}00280 -\/> \textcolor{keywordtype}{string} \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00281}00281 \mbox{\hyperlink{structkblib_1_1detail_1_1values}{values}}, \mbox{\hyperlink{namespacekblib_1_1detail_a60fec688ea68a688f870726b652cf69f}{detail::str\_type\_t}}...> buf\{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00282}00282 \{\mbox{\hyperlink{structkblib_1_1detail_1_1str__type}{detail::str\_type::convert}}(std::forward(ins))\}...\};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00283}00283 \textcolor{keywordtype}{string} ret;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00284}00284 std::size\_t \mbox{\hyperlink{namespacekblib_1_1fakestd_adb8781bc0e5d1ba4ca4624293c0c98ae}{size}}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00285}00285 = (\mbox{\hyperlink{namespacekblib_a2fdc3a299b0c7c4d8432c253ad3bb1ca}{strsize}}(\textcolor{keyword}{static\_cast<}\mbox{\hyperlink{structkblib_1_1detail_1_1value}{value}}\textcolor{keyword}{>}\&>(buf).v) + ...} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00286}00286 + 0);} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00287}00287 ret.reserve(\mbox{\hyperlink{namespacekblib_1_1fakestd_adb8781bc0e5d1ba4ca4624293c0c98ae}{size}});} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00288}00288 \mbox{\hyperlink{namespacekblib_ab4642bf06f44ec657126cea9a3272f1c}{append}}(ret, \textcolor{keyword}{static\_cast<}\mbox{\hyperlink{structkblib_1_1detail_1_1value}{value}}\textcolor{keyword}{>}\&>(buf).v...);} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00289}00289 \textcolor{keywordflow}{return} ret;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00290}00290 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00291}00291 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00292}00292 \} \textcolor{comment}{// namespace detail}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00293}00293 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00304}00304 \textcolor{keyword}{template} <\textcolor{keyword}{typename} \textcolor{keywordtype}{string} = std::string, \textcolor{keyword}{typename} F, \textcolor{keyword}{typename}... S>} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00305}\mbox{\hyperlink{namespacekblib_a56615de712caf1b43a541f5387a4b847}{00305}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_abf1c606d3818a88fc90e6a264711c671}{concat}}(F\&\& f, S\&\&... ins) -\/> \textcolor{keywordtype}{string} \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00306}00306 \textcolor{keywordflow}{return} detail::concat\_impl(} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00307}00307 std::make\_index\_sequence<1 + \textcolor{keyword}{sizeof}...(S)>\{\}, std::forward(f),} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00308}00308 std::forward(ins)...);} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00309}00309 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00310}00310 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00318}00318 \textcolor{keyword}{template} <\textcolor{keyword}{typename} \textcolor{keywordtype}{string} = std::\textcolor{keywordtype}{string}, \textcolor{keyword}{typename} str>} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00319}\mbox{\hyperlink{namespacekblib_abf1c606d3818a88fc90e6a264711c671}{00319}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_abf1c606d3818a88fc90e6a264711c671}{concat}}(std::initializer\_list ins) -\/> \textcolor{keywordtype}{string} \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00320}00320 \textcolor{keywordtype}{string} ret;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00321}00321 ret.reserve(\mbox{\hyperlink{namespacekblib_abedf2e5c556e6ab3ebb779227172a2ac}{std::accumulate}}(} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00322}00322 ins.begin(), ins.end(), std::size\_t\{0\},} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00323}00323 [](std::size\_t z, \textcolor{keyword}{const} str\& s) \{ return z + strsize(s); \}));} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00324}00324 \textcolor{keywordflow}{for} (\textcolor{keyword}{auto}\&\& s : ins) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00325}00325 \mbox{\hyperlink{namespacekblib_ab4642bf06f44ec657126cea9a3272f1c}{append}}(ret, s);} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00326}00326 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00327}00327 \textcolor{keywordflow}{return} ret;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00328}00328 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00329}00329 \textcolor{preprocessor}{\# endif}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00330}00330 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00331}\mbox{\hyperlink{namespacekblib_a9ac0c26180c8c2c92776c9f5ab5d9cb5}{00331}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{inline} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a1b60023a02def7bd83ee293cb48979fb}{isspace}}(\textcolor{keywordtype}{char} c) -\/> \textcolor{keywordtype}{bool} \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00332}00332 \textcolor{keywordflow}{return} \mbox{\hyperlink{namespacekblib_a1b60023a02def7bd83ee293cb48979fb}{std::isspace}}(\mbox{\hyperlink{namespacekblib_af9e250fffa2922e623baa08aa8994f54}{to\_unsigned}}(c));} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00333}00333 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00334}\mbox{\hyperlink{namespacekblib_a1b60023a02def7bd83ee293cb48979fb}{00334}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{inline} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a1b60023a02def7bd83ee293cb48979fb}{isspace}}(\textcolor{keywordtype}{wchar\_t} c) -\/> \textcolor{keywordtype}{bool} \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00335}00335 \textcolor{keywordflow}{return} iswspace(\mbox{\hyperlink{namespacekblib_af9e250fffa2922e623baa08aa8994f54}{to\_unsigned}}(c));} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00336}00336 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00337}00337 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00338}\mbox{\hyperlink{structkblib_1_1is__space}{00338}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1is__space}{is\_space}} \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00339}\mbox{\hyperlink{structkblib_1_1is__space_ae7654e7b77d871668b021772dbc082fa}{00339}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{structkblib_1_1is__space_ae7654e7b77d871668b021772dbc082fa}{operator()}}(\textcolor{keywordtype}{char} c) -\/> \textcolor{keywordtype}{bool} \{ \textcolor{keywordflow}{return} \mbox{\hyperlink{namespacekblib_a1b60023a02def7bd83ee293cb48979fb}{isspace}}(c); \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00340}\mbox{\hyperlink{structkblib_1_1is__space_a55b3413c596f9dec214b07ec21ef799f}{00340}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{structkblib_1_1is__space_a55b3413c596f9dec214b07ec21ef799f}{operator()}}(\textcolor{keywordtype}{wchar\_t} c) -\/> \textcolor{keywordtype}{bool} \{ \textcolor{keywordflow}{return} \mbox{\hyperlink{namespacekblib_a1b60023a02def7bd83ee293cb48979fb}{isspace}}(c); \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00341}00341 \};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00342}00342 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00343}\mbox{\hyperlink{namespacekblib_a93e9fd5013f05b5433d36a010f7d447d}{00343}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} \textcolor{keyword}{inline} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a1d56bb6caa6ddf9f4bed73116501d2ed}{isAspace}}(\textcolor{keywordtype}{char} c) -\/> \textcolor{keywordtype}{bool} \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00344}00344 \textcolor{keywordflow}{for} (\textcolor{keyword}{auto} v : \textcolor{stringliteral}{"{} \(\backslash\)t\(\backslash\)r\(\backslash\)n\(\backslash\)f\(\backslash\)v"{}}) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00345}00345 \textcolor{keywordflow}{if} (c == v) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00346}00346 \textcolor{keywordflow}{return} \textcolor{keyword}{true};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00347}00347 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00348}00348 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00349}00349 \textcolor{keywordflow}{return} \textcolor{keyword}{false};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00350}00350 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00351}\mbox{\hyperlink{namespacekblib_a1d56bb6caa6ddf9f4bed73116501d2ed}{00351}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} \textcolor{keyword}{inline} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a1d56bb6caa6ddf9f4bed73116501d2ed}{isAspace}}(\textcolor{keywordtype}{wchar\_t} c) -\/> \textcolor{keywordtype}{bool} \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00352}00352 \textcolor{keywordflow}{for} (\textcolor{keyword}{auto} v : L\textcolor{stringliteral}{"{} \(\backslash\)t\(\backslash\)r\(\backslash\)n\(\backslash\)f\(\backslash\)v"{}}) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00353}00353 \textcolor{keywordflow}{if} (c == v) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00354}00354 \textcolor{keywordflow}{return} \textcolor{keyword}{true};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00355}00355 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00356}00356 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00357}00357 \textcolor{keywordflow}{return} \textcolor{keyword}{false};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00358}00358 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00359}00359 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00369}00369 \textcolor{keyword}{template} <\textcolor{keyword}{typename} range, \textcolor{keyword}{typename} \textcolor{keywordtype}{string} = std::\textcolor{keywordtype}{string}>} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00370}\mbox{\hyperlink{namespacekblib_a6127fe0b8fdc5d0374a81eddf28749df}{00370}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a6127fe0b8fdc5d0374a81eddf28749df}{join}}(\textcolor{keyword}{const} \mbox{\hyperlink{namespacekblib_a72690688922a2d4ae9a3e46ff0c1a9a9}{range}}\& in, \textcolor{keyword}{const} \textcolor{keywordtype}{string}\& joiner = \textcolor{stringliteral}{"{}"{}}) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00371}00371 \textcolor{keywordflow}{if} (\mbox{\hyperlink{namespacekblib_1_1fakestd_adb8781bc0e5d1ba4ca4624293c0c98ae}{fakestd::size}}(in) > 0) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00372}00372 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00373}00373 \textcolor{keyword}{auto} len = \mbox{\hyperlink{namespacekblib_abedf2e5c556e6ab3ebb779227172a2ac}{kblib::accumulate}}(} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00374}00374 begin(in), end(in), std::size\_t\{\},} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00375}00375 [](std::size\_t l, \textcolor{keyword}{const} \textcolor{keyword}{auto}\& x) \{ \textcolor{keywordflow}{return} l + \mbox{\hyperlink{namespacekblib_a2fdc3a299b0c7c4d8432c253ad3bb1ca}{strsize}}(x); \});} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00376}00376 \textcolor{keyword}{auto} ret = *begin(in);} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00377}00377 \mbox{\hyperlink{namespacekblib_a7035cf97e9bcba5add3b1462ac01a0ed}{try\_reserve}}(ret, len);} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00378}00378 \mbox{\hyperlink{namespacekblib_ac912dd210d34963da9bd40a1a6296308}{kblib::copy}}(next(begin(in)), end(in),} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00379}00379 \mbox{\hyperlink{namespacekblib_a18d941bdcaa41e86334ca14ffa954b28}{consumer}}([\&](\textcolor{keyword}{const} \textcolor{keyword}{auto}\& x) \{ \mbox{\hyperlink{namespacekblib_ab4642bf06f44ec657126cea9a3272f1c}{append}}(ret, joiner, x); \}));} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00380}00380 \textcolor{keywordflow}{return} ret;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00381}00381 \} \textcolor{keywordflow}{else} \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00382}00382 \textcolor{keywordflow}{return} \textcolor{keyword}{typename} \mbox{\hyperlink{structkblib_1_1value__type__linear}{value\_type\_linear::type}}\{\};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00383}00383 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00384}00384 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00385}00385 \textcolor{preprocessor}{\#endif }\textcolor{comment}{// KBLIB\_USE\_CXX17}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00386}00386 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00395}00395 \textcolor{keyword}{template} <\textcolor{keyword}{typename} Container = std::vector, \textcolor{keyword}{typename} Predicate,} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00396}00396 \textcolor{keyword}{typename} String>} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00397}\mbox{\hyperlink{namespacekblib_a05a551b96ff921bdd62cd2fc0110c54d}{00397}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a34cba269622ee9886da3de3d723e1e3e}{split\_tokens}}(\textcolor{keyword}{const} String\& in, Predicate spacer)} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00398}00398 -\/> \mbox{\hyperlink{namespacekblib_acdb4473ef9196a18a0e37e05171729f0}{return\_assert\_t}}<} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00399}00399 \mbox{\hyperlink{structkblib_1_1is__callable}{is\_callable}}::value,} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00401}00401 Container> \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00402}00402 Container ret\{\};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00403}00403 \textcolor{keywordtype}{bool} delim\_run = \textcolor{keyword}{true};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00404}00404 \textcolor{keyword}{const} \textcolor{keywordtype}{char}* begpos\{\};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00405}00405 \textcolor{keyword}{auto} endpos = begpos;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00406}00406 \textcolor{keywordflow}{for} (\textcolor{keyword}{const} \textcolor{keyword}{auto}\& c : in) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00407}00407 \textcolor{keywordflow}{if} (delim\_run) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00408}00408 \textcolor{comment}{// keep begpos updated as long as in a delimiter run}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00409}00409 begpos = \&c;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00410}00410 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00411}00411 \textcolor{keywordflow}{if} (spacer(c) and not \mbox{\hyperlink{namespacekblib_a0c3f29dc7d19ffe01f977ce294ee537a}{std::exchange}}(delim\_run, \textcolor{keyword}{true})) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00412}00412 \textcolor{comment}{// c is first of a run of delimiters}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00413}00413 ret.emplace\_back(begpos, \&c -\/ begpos);} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00414}00414 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (not spacer(c)) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00415}00415 \textcolor{comment}{// c is not a delimiter}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00416}00416 delim\_run = \textcolor{keyword}{false};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00417}00417 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00418}00418 endpos = \&c;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00419}00419 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00420}00420 \textcolor{keywordflow}{if} (not delim\_run and begpos != endpos) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00421}00421 ret.emplace\_back(begpos, endpos -\/ begpos + 1);} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00422}00422 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00423}00423 \textcolor{keywordflow}{return} ret;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00424}00424 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00425}00425 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00432}00432 \textcolor{keyword}{template} <\textcolor{keyword}{typename} Container = std::vector, \textcolor{keyword}{typename} String>} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00433}\mbox{\hyperlink{namespacekblib_a288c8338128b43f633100be6f592e3ec}{00433}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a34cba269622ee9886da3de3d723e1e3e}{split\_tokens}}(\textcolor{keyword}{const} String\& in) -\/> Container \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00434}00434 \textcolor{keywordflow}{return} \mbox{\hyperlink{namespacekblib_a34cba269622ee9886da3de3d723e1e3e}{split\_tokens}}(in, \mbox{\hyperlink{structkblib_1_1is__space}{is\_space}}\{\});} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00435}00435 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00436}00436 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00444}00444 \textcolor{keyword}{template} <\textcolor{keyword}{typename} Container = std::vector, \textcolor{keyword}{typename} String>} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00445}\mbox{\hyperlink{namespacekblib_a34cba269622ee9886da3de3d723e1e3e}{00445}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a34cba269622ee9886da3de3d723e1e3e}{split\_tokens}}(} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00446}00446 \textcolor{keyword}{const} String\& in, \textcolor{keyword}{typename} Container::value\_type::value\_type delim)} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00447}00447 -\/> Container \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00448}00448 Container ret\{\};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00449}00449 \textcolor{keywordtype}{bool} delim\_run = \textcolor{keyword}{true};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00450}00450 \textcolor{keyword}{using }CharT = \textcolor{keyword}{typename} Container::value\_type::value\_type;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00451}00451 \textcolor{keyword}{const} CharT* begpos\{\};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00452}00452 \textcolor{keyword}{auto} endpos = begpos;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00453}00453 \textcolor{keywordflow}{for} (\textcolor{keyword}{const} CharT\& c : in) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00454}00454 \textcolor{keywordflow}{if} (delim\_run) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00455}00455 \textcolor{comment}{// keep begpos updated as long as in a delimiter run}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00456}00456 begpos = \&c;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00457}00457 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00458}00458 \textcolor{keywordflow}{if} (c == delim and not \mbox{\hyperlink{namespacekblib_a0c3f29dc7d19ffe01f977ce294ee537a}{std::exchange}}(delim\_run, \textcolor{keyword}{true})) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00459}00459 \textcolor{comment}{// c is first of a run of delimiters}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00460}00460 ret.emplace\_back(begpos, \&c -\/ begpos);} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00461}00461 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (c != delim) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00462}00462 \textcolor{comment}{// c is not a delimiter}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00463}00463 delim\_run = \textcolor{keyword}{false};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00464}00464 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00465}00465 endpos = \&c;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00466}00466 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00467}00467 \textcolor{keywordflow}{if} (not delim\_run and begpos != endpos) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00468}00468 ret.emplace\_back(\&*begpos, endpos -\/ begpos + 1);} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00469}00469 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00470}00470 \textcolor{keywordflow}{return} ret;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00471}00471 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00472}00472 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00473}00473 \textcolor{keyword}{template} <\textcolor{keyword}{typename} Container = std::vector, \textcolor{keyword}{typename} String>} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00474}\mbox{\hyperlink{namespacekblib_a47a95399524c0bca50361169128f9db9}{00474}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a47a95399524c0bca50361169128f9db9}{kbsplit2}}(\textcolor{keyword}{const} String\& in, \textcolor{keywordtype}{char} delim = \textcolor{charliteral}{' '}) -\/> Container \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00475}00475 Container ret\{\textcolor{stringliteral}{"{}"{}}\};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00476}00476 \textcolor{keywordtype}{bool} delim\_run = \textcolor{keyword}{true};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00477}00477 \textcolor{keywordflow}{for} (\textcolor{keywordtype}{char} c : in) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00478}00478 \textcolor{keywordflow}{if} (c == delim and not \mbox{\hyperlink{namespacekblib_a0c3f29dc7d19ffe01f977ce294ee537a}{std::exchange}}(delim\_run, \textcolor{keyword}{true})) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00479}00479 \textcolor{comment}{// c is first of a run of delimiters}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00480}00480 ret.emplace\_back();} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00481}00481 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (c != delim) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00482}00482 \textcolor{comment}{// c is not a delimiter}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00483}00483 delim\_run = \textcolor{keyword}{false};} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00484}00484 ret.back().push\_back(c);} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00485}00485 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00486}00486 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00487}00487 \textcolor{keywordflow}{if} (ret.back().empty()) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00488}00488 ret.pop\_back();} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00489}00489 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00490}00490 \textcolor{keywordflow}{return} ret;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00491}00491 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00492}00492 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00500}00500 \textcolor{keyword}{template} <\textcolor{keyword}{typename} Container = std::vector, \textcolor{keyword}{typename} String>} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00501}\mbox{\hyperlink{namespacekblib_aae5eb815715bae10bdcc0ea9475cfb7c}{00501}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_acbe121310e870b5e6281ce2a300c47f6}{split\_dsv}}(\textcolor{keyword}{const} String\& str, \textcolor{keywordtype}{char} delim) -\/> Container \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00502}00502 Container ret;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00503}00503 \textcolor{keywordflow}{for} (std::size\_t pos1\{\}, pos2\{str.find(delim)\}; pos1 != str.npos;) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00504}00504 ret.emplace\_back(str, pos1, pos2 -\/ pos1);} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00505}00505 pos1 = \mbox{\hyperlink{namespacekblib_a0c3f29dc7d19ffe01f977ce294ee537a}{std::exchange}}(pos2, str.find(delim, pos2 + 1));} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00506}00506 \textcolor{keywordflow}{if} (pos1 != str.npos) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00507}00507 ++pos1;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00508}00508 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00509}00509 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00510}00510 \textcolor{keywordflow}{return} ret;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00511}00511 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00512}00512 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00520}00520 \textcolor{keyword}{template} <\textcolor{keyword}{typename} Container = std::vector, \textcolor{keyword}{typename} String,} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00521}00521 \textcolor{keyword}{typename} Predicate>} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00522}\mbox{\hyperlink{namespacekblib_acbe121310e870b5e6281ce2a300c47f6}{00522}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_acbe121310e870b5e6281ce2a300c47f6}{split\_dsv}}(\textcolor{keyword}{const} String\& str, Predicate delim)} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00523}00523 -\/> \mbox{\hyperlink{namespacekblib_acdb4473ef9196a18a0e37e05171729f0}{return\_assert\_t}}<} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00524}00524 \mbox{\hyperlink{structkblib_1_1is__callable}{is\_callable}}::value,} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00526}00526 Container> \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00527}00527 Container ret;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00528}00528 \textcolor{keywordflow}{for} (std::size\_t pos1\{\}, pos2\{str.find(delim)\}; pos1 != str.npos;) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00529}00529 ret.emplace\_back(str, pos1, pos2 -\/ pos1);} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00530}00530 pos1 = \mbox{\hyperlink{namespacekblib_a0c3f29dc7d19ffe01f977ce294ee537a}{std::exchange}}(} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00531}00531 pos2, \mbox{\hyperlink{namespacekblib_ae565c2bd3542ecc900319508c4204a0d}{kblib::find\_in\_if}}(str.begin() + pos1 + 1, str.end(), delim));} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00532}00532 \textcolor{keywordflow}{if} (pos1 != str.npos) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00533}00533 ++pos1;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00534}00534 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00535}00535 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00536}00536 \textcolor{keywordflow}{return} ret;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00537}00537 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00538}00538 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00539}00539 \textcolor{comment}{// TODO(killerbee13): figure out if any uses of reverseStr, toLower, toUpper}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00540}00540 \textcolor{comment}{// exist in current projects}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00541}00541 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00551}00551 \textcolor{keyword}{template} <\textcolor{keyword}{typename} \textcolor{keywordtype}{string}>} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00552}\mbox{\hyperlink{namespacekblib_a91ab01237b8d6ef57f55a74300815c6e}{00552}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a91ab01237b8d6ef57f55a74300815c6e}{reverse\_str}}(\textcolor{keywordtype}{string} val) -\/> \textcolor{keywordtype}{string} \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00553}00553 std::reverse(val.begin(), val.end());} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00554}00554 \textcolor{keywordflow}{return} val;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00555}00555 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00556}00556 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00557}00557 \textcolor{keyword}{namespace }detail \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00558}00558 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00559}00559 \textcolor{keyword}{template} <\textcolor{keyword}{typename} CharT>} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00560}\mbox{\hyperlink{namespacekblib_1_1detail_a837096897f96ab13aad120004c627f08}{00560}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{inline} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail_a837096897f96ab13aad120004c627f08}{to\_int\_type}}(CharT ch) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00561}00561 \textcolor{keywordflow}{return} \mbox{\hyperlink{namespacekblib_1_1detail_a837096897f96ab13aad120004c627f08}{std::char\_traits::to\_int\_type}}(ch);} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00562}00562 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00563}00563 \textcolor{keyword}{template} <\textcolor{keyword}{typename} CharT, \textcolor{keyword}{typename} IntT>} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00564}\mbox{\hyperlink{namespacekblib_1_1detail_a144a5c91984c56014efceb17cd66800e}{00564}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{inline} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail_a144a5c91984c56014efceb17cd66800e}{to\_char\_type}}(IntT ch) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00565}00565 \textcolor{keywordflow}{return} \mbox{\hyperlink{namespacekblib_1_1detail_a144a5c91984c56014efceb17cd66800e}{std::char\_traits::to\_char\_type}}(ch);} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00566}00566 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00567}00567 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00568}\mbox{\hyperlink{namespacekblib_1_1detail_a963222bf43702a2b2f274c59a76a26da}{00568}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{inline} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a4bd8237188786dec83b4d7f5e6d05139}{tolower}}(\textcolor{keywordtype}{char} ch) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00569}00569 \textcolor{keywordflow}{return} to\_char\_type(\mbox{\hyperlink{namespacekblib_a4bd8237188786dec83b4d7f5e6d05139}{std::tolower}}(\mbox{\hyperlink{namespacekblib_1_1detail_a837096897f96ab13aad120004c627f08}{to\_int\_type}}(ch)));} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00570}00570 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00571}00571 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00572}\mbox{\hyperlink{namespacekblib_1_1detail_a5c36259b747c433960c63641bd39c2af}{00572}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{inline} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail_a5c36259b747c433960c63641bd39c2af}{towlower}}(\textcolor{keywordtype}{wchar\_t} ch) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00573}00573 \textcolor{keywordflow}{return} to\_char\_type(\mbox{\hyperlink{namespacekblib_1_1detail_a5c36259b747c433960c63641bd39c2af}{std::towlower}}(\mbox{\hyperlink{namespacekblib_1_1detail_a837096897f96ab13aad120004c627f08}{to\_int\_type}}(ch)));} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00574}00574 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00575}00575 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00576}\mbox{\hyperlink{namespacekblib_1_1detail_a3d9c847e2f656fb6fed6f21b0339717d}{00576}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{inline} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_ac1094a7e020c9186d0e3a608f9ff70f4}{toupper}}(\textcolor{keywordtype}{char} ch) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00577}00577 \textcolor{keywordflow}{return} to\_char\_type(\mbox{\hyperlink{namespacekblib_ac1094a7e020c9186d0e3a608f9ff70f4}{std::toupper}}(\mbox{\hyperlink{namespacekblib_1_1detail_a837096897f96ab13aad120004c627f08}{to\_int\_type}}(ch)));} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00578}00578 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00579}00579 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00580}\mbox{\hyperlink{namespacekblib_1_1detail_abf2db1653c3914ae47a28329b51986fe}{00580}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{inline} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail_abf2db1653c3914ae47a28329b51986fe}{towupper}}(\textcolor{keywordtype}{wchar\_t} ch) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00581}00581 \textcolor{keywordflow}{return} to\_char\_type(\mbox{\hyperlink{namespacekblib_1_1detail_abf2db1653c3914ae47a28329b51986fe}{std::towupper}}(\mbox{\hyperlink{namespacekblib_1_1detail_a837096897f96ab13aad120004c627f08}{to\_int\_type}}(ch)));} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00582}00582 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00583}00583 \} \textcolor{comment}{// namespace detail}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00590}00590 \textcolor{comment}{}\textcolor{keyword}{template} <\textcolor{keyword}{typename} \textcolor{keywordtype}{string}>} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00591}\mbox{\hyperlink{namespacekblib_a4bd8237188786dec83b4d7f5e6d05139}{00591}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a4bd8237188786dec83b4d7f5e6d05139}{tolower}}(\textcolor{keywordtype}{string} str) -\/> \textcolor{keywordtype}{string} \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00592}00592 \mbox{\hyperlink{namespacekblib_aff53cc55f02129e6192d7a87c7cdf7f0}{std::transform}}(str.begin(), str.end(), str.begin(),} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00593}00593 [](\textcolor{keyword}{auto} c) \{ return detail::tolower(c); \});} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00594}00594 \textcolor{keywordflow}{return} str;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00595}00595 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00596}00596 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00603}00603 \textcolor{keyword}{template} <\textcolor{keyword}{typename} \textcolor{keywordtype}{string}>} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00604}\mbox{\hyperlink{namespacekblib_ac1094a7e020c9186d0e3a608f9ff70f4}{00604}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_ac1094a7e020c9186d0e3a608f9ff70f4}{toupper}}(\textcolor{keywordtype}{string} str) -\/> \textcolor{keywordtype}{string} \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00605}00605 \mbox{\hyperlink{namespacekblib_aff53cc55f02129e6192d7a87c7cdf7f0}{std::transform}}(str.begin(), str.end(), str.begin(),} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00606}00606 [](\textcolor{keyword}{auto} c) \{ return detail::toupper(c); \});} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00607}00607 \textcolor{keywordflow}{return} str;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00608}00608 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00609}00609 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00621}00621 \textcolor{keyword}{template} <\textcolor{keyword}{typename} \textcolor{keywordtype}{string}>} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00622}\mbox{\hyperlink{namespacekblib_a5666bcdc72292d36178a604c518c1ba8}{00622}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_ae53be72bf8b3efff5d7a930ea6886cc0}{repeat}}(\textcolor{keywordtype}{string} val, std::size\_t count) -\/> \textcolor{keywordtype}{string} \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00623}00623 \textcolor{keywordtype}{string} tmp;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00624}00624 \mbox{\hyperlink{namespacekblib_a7035cf97e9bcba5add3b1462ac01a0ed}{try\_reserve}}(tmp, \mbox{\hyperlink{namespacekblib_1_1fakestd_adb8781bc0e5d1ba4ca4624293c0c98ae}{fakestd::size}}(val) * count);} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00625}00625 \textcolor{keywordflow}{for} (std::size\_t i = 0; i < count; ++i) \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00626}00626 tmp += val;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00627}00627 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00628}00628 \textcolor{keywordflow}{return} tmp;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00629}00629 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00639}\mbox{\hyperlink{namespacekblib_ae53be72bf8b3efff5d7a930ea6886cc0}{00639}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{inline} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_ae53be72bf8b3efff5d7a930ea6886cc0}{repeat}}(\textcolor{keywordtype}{char} val, std::size\_t count) -\/> std::string \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00640}00640 \textcolor{keywordflow}{return} std::string(count, val);} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00641}00641 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00642}00642 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00643}00643 \textcolor{preprocessor}{\#if KBLIB\_USE\_STRING\_VIEW}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00644}00644 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00651}\mbox{\hyperlink{namespacekblib_a7743f2e2f0dd3bd1542fa49368907206}{00651}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{inline} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a19adf8b75cebbc58c92f2ade7a3f2e87}{ends\_with}}(std::string\_view haystack,} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00652}00652 std::string\_view needle) -\/> \textcolor{keywordtype}{bool} \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00653}00653 \textcolor{keywordflow}{return} haystack.size() >= needle.size()} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00654}00654 and haystack.compare(haystack.size() -\/ needle.size(),} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00655}00655 std::string\_view::npos, needle)} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00656}00656 == 0;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00657}00657 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00658}00658 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00665}\mbox{\hyperlink{namespacekblib_a19adf8b75cebbc58c92f2ade7a3f2e87}{00665}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{inline} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a19adf8b75cebbc58c92f2ade7a3f2e87}{ends\_with}}(std::string\_view haystack, \textcolor{keywordtype}{char} needle)} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00666}00666 -\/> \textcolor{keywordtype}{bool} \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00667}00667 \textcolor{keywordflow}{return} not haystack.empty() and haystack.back() == needle;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00668}00668 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00669}00669 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00676}\mbox{\hyperlink{namespacekblib_a43d878711202236ccdd3100d878e27f5}{00676}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{inline} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a07cac288890ce291ba1fe97874feba41}{starts\_with}}(std::string\_view haystack,} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00677}00677 std::string\_view needle) -\/> \textcolor{keywordtype}{bool} \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00678}00678 \textcolor{keywordflow}{return} haystack.size() >= needle.size()} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00679}00679 and haystack.compare(0, needle.size(), needle) == 0;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00680}00680 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00681}00681 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00688}\mbox{\hyperlink{namespacekblib_a07cac288890ce291ba1fe97874feba41}{00688}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{inline} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a07cac288890ce291ba1fe97874feba41}{starts\_with}}(std::string\_view haystack, \textcolor{keywordtype}{char} needle)} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00689}00689 -\/> \textcolor{keywordtype}{bool} \{} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00690}00690 \textcolor{keywordflow}{return} not haystack.empty() and haystack.front() == needle;} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00691}00691 \}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00692}00692 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00693}00693 \textcolor{preprocessor}{\#endif}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00694}00694 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00695}00695 \} \textcolor{comment}{// namespace KBLIB\_NS}} \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00696}00696 } \DoxyCodeLine{\Hypertarget{stringops_8h_source_l00697}00697 \textcolor{preprocessor}{\#endif }\textcolor{comment}{// KBLIB\_STRINGOPS\_H}} \end{DoxyCode}