String::CPtr extname(String::CPtr path) { if (!path) return String::create(); String::CPtr base = basename(path); if (base->charAt(0) == '.') return String::create(); Size lastIndex = base->lastIndexOf('.'); if (lastIndex == NO_POS) { return String::create(); } else { return base->substring(lastIndex); } }
static inline Size lastIndexOfSep(String::CPtr str, Size from = NO_POS) { return str->lastIndexOf(SEP, from); }