MCPcopy Create free account
hub / github.com/EricPengShuai/Interview / trimLeftTrailingSpaces

Function trimLeftTrailingSpaces

memo/listnode.cpp:46–50  ·  view source on GitHub ↗

去掉左边 white-space:https://cplusplus.com/reference/cctype/isspace/?kw=isspace

Source from the content-addressed store, hash-verified

44
45// 去掉左边 white-space:https://cplusplus.com/reference/cctype/isspace/?kw=isspace
46void trimLeftTrailingSpaces(string &input) {
47 input.erase(input.begin(), find_if(input.begin(), input.end(), [](int ch) {
48 return !isspace(ch);
49 }));
50}
51
52// base 从其 reverse_iterator还原基础迭代器,因为 earse 参数只能是基础迭代器
53void trimRightTrailingSpaces(string &input) {

Callers 1

stringToIntegerVectorFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected