当前位置: 首页>>代码示例>>C++>>正文


C++ string_view::find_first_not_of方法代码示例

本文整理汇总了C++中string_view::find_first_not_of方法的典型用法代码示例。如果您正苦于以下问题:C++ string_view::find_first_not_of方法的具体用法?C++ string_view::find_first_not_of怎么用?C++ string_view::find_first_not_of使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在string_view的用法示例。


在下文中一共展示了string_view::find_first_not_of方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: add_line_to_multiline_header

void Request::add_line_to_multiline_header(const string_view& line,
                                           const string_view& header)
{
    auto non_whitespace_pos = line.find_first_not_of("\t ");
    if (non_whitespace_pos != line.end())
        if (!header.empty())
            headers_[header.str()] += line.substr(non_whitespace_pos).str();
}
开发者ID:csuvbakka,项目名称:strippy,代码行数:8,代码来源:http_request.cpp

示例2: sscanf

static void
parse_elements (string_view name, TypeDesc type, const char *type_code,
                string_view value, ImageIOParameter &param)
{
    int num_items = type.numelements() * type.aggregate;
    T *data = (T*) param.data();
    // Erase any leading whitespace
    value.remove_prefix (value.find_first_not_of (" \t"));
    for (int i = 0;  i < num_items;  ++i) {
        // Make a temporary copy so we for sure have a 0-terminated string.
        std::string temp = value;
        // Grab the first value from it
        sscanf (temp.c_str(), type_code, &data[i]);
        // Skip the value (eat until we find a delimiter -- space, comma, tab)
        value.remove_prefix (value.find_first_of (" ,\t"));
        // Skip the delimiter
        value.remove_prefix (value.find_first_not_of (" ,\t"));
        if (value.empty())
            break;   // done if nothing left to parse
    }
}
开发者ID:nerd93,项目名称:oiio,代码行数:21,代码来源:formatspec.cpp

示例3: ltrim

void ltrim(string_view& s) noexcept
{
  const auto pos = s.find_first_not_of(Space);
  s.remove_prefix(pos != string_view::npos ? pos : s.size());
}
开发者ID:swirlycloud,项目名称:swirly,代码行数:5,代码来源:String.cpp


注:本文中的string_view::find_first_not_of方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。