8 inline bool hasExt(std::string_view s,
const char* extIn) {
10 return std::string::npos==s.find(
'.');
11 const size_t l = std::strlen(extIn);
14 const size_t off = s.size()-l;
17 for(
size_t i=0;i<l;++i) {
18 char a = char(std::tolower(s[off+i]));
19 char b = char(std::tolower(extIn[i]));
26 inline bool hasExt(
const char* s,
const char* extIn) {
27 const size_t ssize = std::strlen(s);
28 const size_t l = std::strlen(extIn);
31 const size_t off = ssize-l;
34 for(
size_t i=0;i<l;++i) {
35 char a = char(std::tolower(s[off+i]));
36 char b = char(std::tolower(extIn[i]));
43 inline bool exchangeExt(std::string& s,
const char* extIn,
const char* extOut) {
51 const size_t l1 = std::strlen(extIn);
52 const size_t l2 = std::strlen(extOut);
54 s.resize(s.size()+l2-l1);
else
56 s.resize(s.size()+l1-l2);
58 const size_t off = s.size()-l2;
59 for(
size_t i=0;i<l2;++i)
64 inline void assignExt(std::string& s,
const char* extOut){
65 size_t cut = s.rfind(
'.');
66 if(cut==std::string::npos) {
71 const size_t l1 = s.size()-cut-1;
72 const size_t l2 = std::strlen(extOut);
74 s.resize(s.size()+l2-l1);
else
76 s.resize(s.size()+l1-l2);
77 const size_t off = cut+1;
78 for(
size_t i=0;i<l2;++i)
82 inline std::string
addExt(
const std::string& s,
const char* ext){
83 if(s.size()>0 && s.back()==
'.')
bool exchangeExt(std::string &s, const char *extIn, const char *extOut)
bool hasExt(std::string_view s, const char *extIn)
std::string addExt(const std::string &s, const char *ext)
void assignExt(std::string &s, const char *extOut)