// SPDX-License-Identifier: BSD-2-Clause // author: Max Kellermann #include "SplitString.hxx" #include "IterableSplitString.hxx" #include "StringStrip.hxx" std::forward_list SplitString(std::string_view s, char separator, bool strip) noexcept { if (strip) s = StripLeft(s); std::forward_list list; if (s.empty()) return list; auto i = list.before_begin(); for (auto value : IterableSplitString(s, separator)) { if (strip) value = Strip(value); i = list.emplace_after(i, value); } return list; }