std::basic_string_view<CharT,Traits>::remove_prefix
来自cppreference.com
                    
                                        
                    < cpp | string | basic string view
                    
                                                            
                    |   constexpr void remove_prefix(size_type n);  | 
(C++17 起) | |
前向移动视图起点 n 个字符。
若 n > size() 则行为未定义。
参数
| n | - | 要从视图起始移除的字符数 | 
返回值
(无)
复杂度
常数。
示例
运行此代码
#include <iostream> #include <algorithm> #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'
参阅
|   以前移终点收缩视图  (公开成员函数)  |