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


C++ string_t::compare方法代码示例

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


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

示例1: normalize_linux_rid

// For some distros, we don't want to use the full version from VERSION_ID. One example is
// Red Hat Enterprise Linux, which includes a minor version in their VERSION_ID but minor
// versions are backwards compatable.
//
// In this case, we'll normalized RIDs like 'rhel.7.2' and 'rhel.7.3' to a generic
// 'rhel.7'. This brings RHEL in line with other distros like CentOS or Debian which
// don't put minor version numbers in their VERSION_ID fields because all minor versions
// are backwards compatible.
static
pal::string_t normalize_linux_rid(pal::string_t rid)
{
    pal::string_t rhelPrefix(_X("rhel."));

    if (rid.compare(0, rhelPrefix.length(), rhelPrefix) == 0)
    {
        size_t minorVersionSeparatorIndex = rid.find(_X("."), rhelPrefix.length());
        if (minorVersionSeparatorIndex != std::string::npos)
        {
            rid.erase(minorVersionSeparatorIndex, rid.length() - minorVersionSeparatorIndex);
        }
    }

    return rid;
}
开发者ID:gkhanna79,项目名称:core-setup,代码行数:24,代码来源:pal.unix.cpp

示例2: IsUNCExtended

bool LongFile::IsUNCExtended(const pal::string_t& path)
{
    return path.compare(0, UNCExtendedPathPrefix.length(), UNCExtendedPathPrefix) == 0;
}
开发者ID:ericstj,项目名称:core-setup,代码行数:4,代码来源:longfile.windows.cpp

示例3: IsDevice

bool LongFile::IsDevice(const pal::string_t& path)
{
    return path.compare(0, DevicePathPrefix.length(), DevicePathPrefix) == 0;
}
开发者ID:ericstj,项目名称:core-setup,代码行数:4,代码来源:longfile.windows.cpp

示例4: ends_with

bool ends_with(const pal::string_t& value, const pal::string_t& suffix)
{
    return suffix.length() <= value.length() &&
        (0 == value.compare(value.length() - suffix.length(), suffix.length(), suffix));
}
开发者ID:niemyjski,项目名称:cli,代码行数:5,代码来源:utils.cpp


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