示例#1
0
filesys::path filesys::stem(const path & p)
{
    size_type n = 0, m = p.length() - extension(p).length();

    if (p.find_last_of('/') != path::npos) {
        n = p.find_last_of('/') + 1;
    }
    if (p.find_last_of('\\') != path::npos) {
        n = std::max(n, p.find_last_of('\\') + 1);
    }
    return p.substr(n, m - n);
}
示例#2
0
BEGINNAMESPACE

filesys::path filesys::extension(const path & p)
{
    size_type n = p.find_last_of('.');
    if (n == path::npos) return path();
    return p.substr(n);
}