MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenShadingLanguage / osl_split

Function osl_split

src/liboslexec/opstring.cpp:234–245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

232
233
234OSL_SHADEOP int
235osl_split (const char *str, ustring *results, const char *sep,
236 int maxsplit, int resultslen)
237{
238 maxsplit = OIIO::clamp (maxsplit, 0, resultslen);
239 std::vector<std::string> splits;
240 Strutil::split (USTR(str).string(), splits, USTR(sep).string(), maxsplit);
241 int n = std::min (maxsplit, (int)splits.size());
242 for (int i = 0; i < n; ++i)
243 results[i] = ustring(splits[i]);
244 return n;
245}
246
247
248} // end namespace pvt

Callers

nothing calls this directly

Calls 4

stringMethod · 0.80
clampFunction · 0.70
minFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected