MCPcopy Create free account
hub / github.com/ErrorAtLine0/infinipaint / split_string_by_token

Function split_string_by_token

include/Helpers/StringHelpers.cpp:27–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25#include <SDL3/SDL_iostream.h>
26
27std::vector<std::string> split_string_by_token(std::string str, std::string token) {
28 // slightly modified from: https://stackoverflow.com/a/46943631
29 std::vector<std::string> toRet;
30 while(!str.empty()) {
31 size_t index = str.find(token);
32 if(index != std::string::npos) {
33 toRet.emplace_back(str.substr(0, index));
34 str = str.substr(index + token.size());
35 if(str.empty())
36 toRet.emplace_back(str);
37 }
38 else {
39 toRet.emplace_back(str);
40 return toRet;
41 }
42 }
43 return toRet;
44}
45
46uint8_t ascii_hex_char_to_number_no_checks(char asciiHex) {
47 if(asciiHex <= '9')

Calls 3

emptyMethod · 0.45
findMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected