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


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

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


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

示例1: wcstring_tok

wcstring_range wcstring_tok(wcstring& str, const wcstring &needle, wcstring_range last)
{
    size_type pos = last.second == wcstring::npos ? wcstring::npos : last.first;
    if (pos != wcstring::npos && last.second != wcstring::npos) pos += last.second;
    if (pos != wcstring::npos && pos != 0) ++pos;
    if (pos == wcstring::npos || pos >= str.size())
    {
        return std::make_pair(wcstring::npos, wcstring::npos);
    }

    if (needle.empty())
    {
        return std::make_pair(pos, wcstring::npos);
    }

    pos = str.find_first_not_of(needle, pos);
    if (pos == wcstring::npos) return std::make_pair(wcstring::npos, wcstring::npos);

    size_type next_pos = str.find_first_of(needle, pos);
    if (next_pos == wcstring::npos)
    {
        return std::make_pair(pos, wcstring::npos);
    }
    else
    {
        str[next_pos] = L'\0';
        return std::make_pair(pos, next_pos - pos);
    }
}
开发者ID:TravelC,项目名称:fish-shell,代码行数:29,代码来源:wcstringutil.cpp

示例2: expand_is_clean

/// Test if the specified argument is clean, i.e. it does not contain any tokens which need to be
/// expanded or otherwise altered. Clean strings can be passed through expand_string and expand_one
/// without changing them. About two thirds of all strings are clean, so skipping expansion on them
/// actually does save a small amount of time, since it avoids multiple memory allocations during
/// the expansion process.
///
/// \param in the string to test
static bool expand_is_clean(const wcstring &in) {
    if (in.empty()) return true;

    // Test characters that have a special meaning in the first character position.
    if (wcschr(UNCLEAN_FIRST, in.at(0)) != NULL) return false;

    // Test characters that have a special meaning in any character position.
    return in.find_first_of(UNCLEAN) == wcstring::npos;
}
开发者ID:raichoo,项目名称:fish-shell,代码行数:16,代码来源:expand.cpp

示例3: wcsfuncname

/// Test if the string is a valid function name.
///
/// \return true if it is valid else false.
bool wcsfuncname(const wcstring &str) {
    if (str.size() == 0) return false;
    if (str.at(0) == L'-') return false;
    if (str.find_first_of(L'/') != wcstring::npos) return false;
    return true;
}
开发者ID:scorphus,项目名称:fish-shell,代码行数:9,代码来源:wutil.cpp


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