Skip to content

adnan007d/string-split-cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

3 Commits

Repository files navigation

String Split implementation in C++

Source Code

autosplit(std::vector<std::string> &result, std::string_view s, std::string_view t) -> std::vector<std::string> &{if (t.empty()){result.emplace_back(s); return result} result.reserve(s.size()); if (!s.empty()){std::size_t first = 0; while (first < s.size()){constauto foundIndex = s.find(t, first); constauto last = foundIndex < s.size() ? foundIndex : s.size(); result.emplace_back(s.begin() + first, s.begin() + last); first = last + t.size()} } return result}

benchmark results between

  • Boost string split
  • Stackoverflow solution for split
  • Split function that I wrote

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published