std::basic_string_view::remove_prefix
性病:基本[医]弦[医]意见::删除[医]前缀
constexpr void remove_prefix(size_type n | | (since C++17) |
---|
将视图的开始向前移动n
人物。
如果n > size()...
参数
n | - | number of characters to remove from the start of the view |
---|
返回值
%280%29
复杂性
常量。
例
二次
#include <iostream>
#include <string_view>
int main()
{
std::string str = " trim me";
std::string_view v = str;
v.remove_prefix(std::min(v.find_first_not_of(" "), v.size())
std::cout << "String: '" << str << "'\n"
<< "View : '" << v << "'\n";
}
二次
产出:
二次
String: ' trim me'
View : 'trim me'
二次
另见
remove_suffix | shrinks the view by moving its end backward (public member function) |
---|
© cppreference.com
在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。
http://en.cppreference.com/w/cpp/string/basic[医]弦[医]查看/删除[医]前缀