diff options
| author | Yuqian Yang <crupest@crupest.life> | 2025-11-15 16:43:25 +0800 |
|---|---|---|
| committer | Yuqian Yang <crupest@crupest.life> | 2025-11-16 00:01:49 +0800 |
| commit | 246eb9266b9349b44cbe96f3f839124ab30cbb89 (patch) | |
| tree | 31604c8a4764d3a601d56599e56c98d91bd97758 /include/cru/base/StringUtil.h | |
| parent | b92aa78ac19476049ab881b49c51b1a970a4a973 (diff) | |
| download | cru-246eb9266b9349b44cbe96f3f839124ab30cbb89.tar.gz cru-246eb9266b9349b44cbe96f3f839124ab30cbb89.tar.bz2 cru-246eb9266b9349b44cbe96f3f839124ab30cbb89.zip | |
Impl win subprocess.
Diffstat (limited to 'include/cru/base/StringUtil.h')
| -rw-r--r-- | include/cru/base/StringUtil.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/cru/base/StringUtil.h b/include/cru/base/StringUtil.h index 5c1c4be7..d3afda1d 100644 --- a/include/cru/base/StringUtil.h +++ b/include/cru/base/StringUtil.h @@ -39,6 +39,22 @@ struct SplitOptions { static constexpr SplitOption RemoveSpace = SplitOption::FromOffset(2); }; +template <typename R> +std::string Join(std::string_view sep, const R& range) { + bool start = true; + std::string result; + for (const auto& s : range) { + if (start) { + result += s; + start = false; + } else { + result += sep; + result += s; + } + } + return result; +} + std::vector<std::string> CRU_BASE_API Split(std::string_view str, std::string_view sep, SplitOption options = {}); |
