| 232 | |
| 233 | |
| 234 | OSL_SHADEOP int |
| 235 | osl_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 |