Пример #1
0
bool starts_with(const pal::string_t& value, const pal::string_t& prefix, bool match_case)
{
    if (prefix.empty())
    {
        // Cannot start with an empty string.
        return false;
    }
    auto cmp = match_case ? pal::strncmp : pal::strncasecmp;
    return (value.size() >= prefix.size()) &&
        cmp(value.c_str(), prefix.c_str(), prefix.size()) == 0;
}
Пример #2
0
bool ShouldNormalizeWorker(const pal::string_t& path)
{
    if (LongFile::IsNormalized(path))
        return false;

    if (!LongFile::IsPathNotFullyQualified(path) && path.size() < MAX_PATH)
        return false;

    return true;
}
Пример #3
0
bool ends_with(const pal::string_t& value, const pal::string_t& suffix, bool match_case)
{
    auto cmp = match_case ? pal::strcmp : pal::strcasecmp;
    return (value.size() >= suffix.size()) &&
        cmp(value.c_str() + value.size() - suffix.size(), suffix.c_str()) == 0;
}