mlpack  master
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.
Definition: binarize.hpp:18
The core includes that mlpack expects; standard C++ includes and Armadillo.
test cpp RESULT_VARIABLE MEX_RESULT_TRASH OUTPUT_VARIABLE MEX_OUTPUT ERROR_VARIABLE MEX_ERROR_TRASH string(REGEX MATCH"Warning: You are using"MEX_WARNING"${MEX_OUTPUT}") if(MEX_WARNING) string(REGEX REPLACE".*using [a-zA-Z]* version \"([0-9.]*)[^\"]*\".*""\\1"OTHER_COMPILER_VERSION"$
Definition: CMakeLists.txt:18
std::string Extension(const std::string &filename)
Definition: extension.hpp:21