extension.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_CORE_DATA_EXTENSION_HPP
14 #define MLPACK_CORE_DATA_EXTENSION_HPP
15 
16 #include <mlpack/prereqs.hpp>
17 
18 namespace mlpack {
19 namespace data {
20 
21 inline std::string Extension(const std::string& filename)
22 {
23  const size_t ext = filename.rfind('.');
24  std::string extension;
25  if (ext == std::string::npos)
26  return extension;
27 
28  extension = filename.substr(ext + 1);
29  std::transform(extension.begin(), extension.end(), extension.begin(),
30  ::tolower);
31 
32  return extension;
33 }
34 
35 } // namespace data
36 } // namespace mlpack
37 
38 #endif
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.
std::string Extension(const std::string &filename)
Definition: extension.hpp:21