MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/MaterialX / incrementName

Function incrementName

source/MaterialXCore/Util.cpp:58–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58string incrementName(const string& name)
59{
60 size_t split = name.length();
61 while (split > 0)
62 {
63 if (!isdigit(name[split - 1]))
64 break;
65 split--;
66 }
67
68 if (split < name.length())
69 {
70 string prefix = name.substr(0, split);
71 string suffix = name.substr(split, name.length());
72 return prefix + std::to_string(std::stoi(suffix) + 1);
73 }
74 return name + "2";
75}
76
77StringVec splitString(const string& str, const string& sep)
78{

Callers 4

CoreUtil.cppFile · 0.85
loadMethod · 0.85
asStringDotMethod · 0.85
createValidChildNameFunction · 0.85

Calls 2

to_stringFunction · 0.85
substrMethod · 0.80

Tested by

no test coverage detected