MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / trim

Function trim

lite/example/cpp_example/npy.h:177–187  ·  view source on GitHub ↗

Removes leading and trailing whitespaces */

Source from the content-addressed store, hash-verified

175 Removes leading and trailing whitespaces
176 */
177inline std::string trim(const std::string& str) {
178 const std::string whitespace = " \t";
179 auto begin = str.find_first_not_of(whitespace);
180
181 if (begin == std::string::npos)
182 return "";
183
184 auto end = str.find_last_not_of(whitespace);
185
186 return str.substr(begin, end - begin + 1);
187}
188
189inline std::string get_value_from_map(const std::string& mapstr) {
190 size_t sep_pos = mapstr.find_first_of(":");

Callers 3

get_value_from_mapFunction · 0.70
parse_dictFunction · 0.70
parse_tupleFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected