summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/mts/MTS_Text.h2
-rw-r--r--src/MTS_Text.cpp7
2 files changed, 9 insertions, 0 deletions
diff --git a/include/mts/MTS_Text.h b/include/mts/MTS_Text.h
index 2380add..4ded3fc 100644
--- a/include/mts/MTS_Text.h
+++ b/include/mts/MTS_Text.h
@@ -137,6 +137,8 @@ namespace MTS {
}
return true;
}
+
+ static std::string getFileExtension(const std::string& filename);
};
}
diff --git a/src/MTS_Text.cpp b/src/MTS_Text.cpp
index d823bfe..8672acb 100644
--- a/src/MTS_Text.cpp
+++ b/src/MTS_Text.cpp
@@ -699,3 +699,10 @@ bool Text::parseHex(uint64_t& value, const std::string& str) {
return ((uint8_t) ss.rdstate() == RDSTATE_SUCCESS_MASK);
}
+std::string Text::getFileExtension(const std::string& filename) {
+ size_t pos = filename.rfind('.', filename.length());
+ if (pos != std::string::npos) {
+ return (filename.substr(pos + 1));
+ }
+ return ("");
+}