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


C++ wcstring::length方法代码示例

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


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

示例1: wcpattern

 wildcard_matcher_t(const wchar_t * /*argv0*/, const wchar_t *pattern,
                    const match_options_t &opts, io_streams_t &streams)
     : string_matcher_t(opts, streams), wcpattern(parse_util_unescape_wildcards(pattern)) {
     if (opts.ignore_case) {
         for (size_t i = 0; i < wcpattern.length(); i++) {
             wcpattern[i] = towlower(wcpattern[i]);
         }
     }
 }
开发者ID:haarts,项目名称:fish-shell,代码行数:9,代码来源:builtin_string.cpp

示例2: wcsrepeat

// Helper function to abstract the repeat logic from string_repeat
// returns the to_repeat string, repeated count times.
static wcstring wcsrepeat(const wcstring &to_repeat, size_t count) {
    wcstring repeated;
    repeated.reserve(to_repeat.length() * count);

    for (size_t j = 0; j < count; j++) {
        repeated += to_repeat;
    }

    return repeated;
}
开发者ID:Hunsu,项目名称:fish-shell,代码行数:12,代码来源:builtin_string.cpp

示例3: trim

/**
   Remove any prefix and suffix newlines from the specified
   string.
 */
static void trim(wcstring &str)
{
    if (str.empty())
        return;

    size_t pos = str.find_first_not_of(L" \n");
    if (pos > 0)
        str.erase(0, pos);

    pos = str.find_last_not_of(L" \n");
    if (pos != wcstring::npos && pos + 1 < str.length())
        str.erase(pos + 1);
}
开发者ID:jayschwa,项目名称:fish-shell,代码行数:17,代码来源:fish_indent.cpp

示例4: wcpattern

 wildcard_matcher_t(const wchar_t * /*argv0*/, const wchar_t *pattern, const options_t &opts,
                    io_streams_t &streams)
     : string_matcher_t(opts, streams), wcpattern(parse_util_unescape_wildcards(pattern)) {
     if (opts.ignore_case) {
         for (size_t i = 0; i < wcpattern.length(); i++) {
             wcpattern[i] = towlower(wcpattern[i]);
         }
     }
     if (opts.entire && !wcpattern.empty()) {
         if (wcpattern.front() != ANY_STRING) wcpattern.insert(0, 1, ANY_STRING);
         if (wcpattern.back() != ANY_STRING) wcpattern.push_back(ANY_STRING);
     }
 }
开发者ID:Hunsu,项目名称:fish-shell,代码行数:13,代码来源:builtin_string.cpp

示例5: wcsrepeat_until

// Helper function to abstract the repeat until logic from string_repeat
// returns the to_repeat string, repeated until max char has been reached.
static wcstring wcsrepeat_until(const wcstring &to_repeat, size_t max) {
    size_t count = max / to_repeat.length();
    size_t mod = max % to_repeat.length();

    return wcsrepeat(to_repeat, count) + to_repeat.substr(0, mod);
}
开发者ID:Hunsu,项目名称:fish-shell,代码行数:8,代码来源:builtin_string.cpp


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