MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / split_string

Function split_string

paddle/utils/string/string_helper.h:121–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119// split string by delim
120template <class T = std::string>
121std::vector<T> split_string(const std::string& str, const std::string& delim) {
122 size_t pre_pos = 0;
123 size_t pos = 0;
124 std::string tmp_str;
125 std::vector<T> res_list;
126 res_list.clear();
127 if (str.empty()) {
128 return res_list;
129 }
130 while ((pos = str.find(delim, pre_pos)) != std::string::npos) {
131 tmp_str.assign(str, pre_pos, pos - pre_pos);
132 res_list.push_back(tmp_str);
133 pre_pos = pos + delim.size();
134 }
135 tmp_str.assign(str, pre_pos, str.length() - pre_pos);
136 res_list.push_back(tmp_str);
137 return res_list;
138}
139
140// split string by spaces. Leading and tailing spaces are ignored. Consecutive
141// spaces are treated as one delim.

Callers 7

ParseEinsumEquationFunction · 0.85
UpdateMethod · 0.85
EinsumGradKernelFunction · 0.85
ValidationCheckFunction · 0.85
ParseEinsumEquationFunction · 0.85
InitializeMethod · 0.85
hdfs_listFunction · 0.85

Calls 8

c_strMethod · 0.80
clearMethod · 0.45
emptyMethod · 0.45
findMethod · 0.45
assignMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected