Changeset 1016
- Timestamp:
- 07/20/20 14:15:14 (4 years ago)
- Location:
- cpp/common
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/common/nonstd.h
r936 r1016 80 80 81 81 82 83 #if defined(__ANDROID__) && !defined(PRIuPTR) 84 #define PRIuPTR "u" //w ktorejs z wersji kompilacji 32 albo 64 bit pewnie brakuje tej definicji w naglowku <inttypes.h>, a w tej drugiej wersji jest. Nie wiem czy "u" jest wlasciwe ale i tak prawdopodobnie naprawili w nowszym ndk... 82 85 #endif 86 87 88 #endif -
cpp/common/util-string.cpp
r913 r1016 79 79 bool str_starts_with(const char *str, const char *prefix) 80 80 { 81 return strncmp(str, prefix,strlen(prefix))==0;81 return strncmp(str, prefix, strlen(prefix)) == 0; 82 82 } 83 83 … … 132 132 return filename.substr(0, slash); 133 133 } 134 135 //trimming functions, https://stackoverflow.com/questions/216823/whats-the-best-way-to-trim-stdstring 136 137 void ltrim_inplace(string &s) 138 { 139 s.erase(s.begin(), find_if(s.begin(), s.end(), [](int ch) { 140 return !isspace(ch); 141 })); 142 } 143 144 void rtrim_inplace(string &s) 145 { 146 s.erase(find_if(s.rbegin(), s.rend(), [](int ch) { 147 return !isspace(ch); 148 }).base(), s.end()); 149 } 150 151 void trim_inplace(string &s) 152 { 153 ltrim_inplace(s); 154 rtrim_inplace(s); 155 } 156 157 string ltrim(string s) 158 { 159 ltrim_inplace(s); 160 return s; 161 } 162 163 string rtrim(string s) 164 { 165 rtrim_inplace(s); 166 return s; 167 } 168 169 string trim(string s) 170 { 171 trim_inplace(s); 172 return s; 173 } -
cpp/common/util-string.h
r913 r1016 21 21 string stripFileDir(const string& filename); // strip path component from filename 22 22 23 void ltrim_inplace(string &s); 24 void rtrim_inplace(string &s); 25 void trim_inplace(string &s); 26 string ltrim(string s); 27 string rtrim(string s); 28 string trim(string s); 29 23 30 #endif
Note: See TracChangeset
for help on using the changeset viewer.