MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / SplitString

Function SplitString

TombEngine/Specific/trutils.cpp:140–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138 }
139
140 std::vector<std::wstring> SplitString(const std::wstring& string)
141 {
142 auto strings = std::vector<std::wstring>{};
143
144 // Exit early if string is single line.
145 if (string.find(L'\n') == std::wstring::npos)
146 {
147 strings.push_back(string);
148 return strings;
149 }
150
151 std::wstring::size_type pos = 0;
152 std::wstring::size_type prev = 0;
153 while ((pos = string.find(L'\n', prev)) != std::string::npos)
154 {
155 strings.push_back(string.substr(prev, pos - prev));
156 prev = pos + 1;
157 }
158
159 strings.push_back(string.substr(prev));
160 return strings;
161 }
162
163 std::vector<std::wstring> SplitWords(const std::wstring& input)
164 {

Callers 1

AddStringMethod · 0.85

Calls 2

findMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected