mlpack: a scalable c++ machine learning library
mlpack  2.0.2
extension.hpp
Go to the documentation of this file.
1 
15 #ifndef mlpack_CORE_DATA_EXTENSION_HPP
16 #define mlpack_CORE_DATA_EXTENSION_HPP
17 
18 #include <mlpack/prereqs.hpp>
19 
20 namespace mlpack {
21 namespace data {
22 
23 inline std::string Extension(const std::string& filename)
24 {
25  const size_t ext = filename.rfind('.');
26  std::string extension;
27  if (ext == std::string::npos)
28  return extension;
29 
30  extension = filename.substr(ext + 1);
31  std::transform(extension.begin(), extension.end(), extension.begin(),
32  ::tolower);
33 
34  return extension;
35 }
36 
37 } // namespace data
38 } // namespace mlpack
39 
40 #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:23