MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / RemoveFileEnding

Function RemoveFileEnding

Source/Utility/strings.cpp:320–337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

318}
319
320string RemoveFileEnding(string in) {
321 size_t last_point = in.size();
322
323 for (int i = in.size() - 1; i >= 0; i--) {
324 if (in[i] == '.') {
325 last_point = i;
326 }
327 if (in[i] == '/') {
328 return in.substr(0, last_point);
329 }
330 }
331
332 if (last_point > 0) {
333 return in.substr(0, last_point);
334 } else {
335 return in;
336 }
337}

Callers 1

GenerateParallelPathFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected