summaryrefslogtreecommitdiff
path: root/src/utils/string.cpp
blob: bb590ca27d67af2cd5d8642e6e2ffe56609f1f74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "string.hpp"

#include <sstream>

namespace silly::editor::utils {
  std::vector<std::string> split_text(const std::string &text, char delimiter) {
    std::vector<std::string> parts;

    std::istringstream iss(text);
    std::string part;

    while (std::getline(iss, part, delimiter)) {
      parts.push_back(part);
    }

    return parts;
  }
}