MCPcopy Create free account
hub / github.com/blender/cycles / string_split

Function string_split

src/util/string.cpp:70–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70void string_split(vector<string> &tokens,
71 const string &str,
72 const string &separators,
73 bool skip_empty_tokens)
74{
75 size_t token_start = 0;
76 size_t token_length = 0;
77 for (size_t i = 0; i < str.size(); ++i) {
78 const char ch = str[i];
79 if (separators.find(ch) == string::npos) {
80 /* Current character is not a separator,
81 * append it to token by increasing token length.
82 */
83 ++token_length;
84 }
85 else {
86 /* Current character is a separator,
87 * append current token to the list.
88 */
89 if (!skip_empty_tokens || token_length > 0) {
90 const string token = str.substr(token_start, token_length);
91 tokens.push_back(token);
92 }
93 token_start = i + 1;
94 token_length = 0;
95 }
96 }
97 /* Append token from the tail of the string if exists. */
98 if (token_length) {
99 const string token = str.substr(token_start, token_length);
100 tokens.push_back(token);
101 }
102}
103
104bool string_startswith(const string_view s, const string_view start)
105{

Callers 9

ShaderGraphBuilderClass · 0.85
TESTFunction · 0.85
xml_read_int_arrayFunction · 0.85
xml_read_float_arrayFunction · 0.85
xml_read_shader_graphFunction · 0.85
xml_read_float_arrayFunction · 0.85
xml_read_nodeFunction · 0.85
_log_messageFunction · 0.85

Calls 2

sizeMethod · 0.45
findMethod · 0.45

Tested by 1

TESTFunction · 0.68