MCPcopy Create free account
hub / github.com/Tencent/phxrpc / StrTrim

Function StrTrim

codegen/code_utils.cpp:34–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32
33
34void StrTrim(string *str, const char *to_trim) {
35 string::size_type start_pos = 0;
36 string::size_type end_pos = 0;
37
38 start_pos = str->find_first_not_of(to_trim);
39
40 end_pos = str->find_last_not_of(to_trim);
41
42 if (start_pos == string::npos || end_pos == string::npos) {
43 *str = "";
44 } else {
45 *str = str->substr(start_pos, end_pos - start_pos + 1);
46 }
47}
48
49void StrReplaceAll(string *haystack, string needle, string s) {
50 string::size_type pos = 0;

Callers 9

GenerateServerMainCppMethod · 0.85
GenerateServerEtcMethod · 0.85
GenerateMakefileMethod · 0.85
GenerateClientHppMethod · 0.85
GenerateClientCppMethod · 0.85
GenerateClientEtcMethod · 0.85
GenerateToolMainCppMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected