OpenMEEG
filenames.h
Go to the documentation of this file.
1 // Project Name: OpenMEEG (http://openmeeg.github.io)
2 // © INRIA and ENPC under the French open source license CeCILL-B.
3 // See full copyright notice in the file LICENSE.txt
4 // If you make a copy of this file, you must either:
5 // - provide also LICENSE.txt and modify this header to refer to it.
6 // - replace this header by the LICENSE.txt content.
7 
8 #pragma once
9 
10 #include <string>
11 #include <filesystem>
12 #include <algorithm>
13 #include <cctype>
14 
15 namespace OpenMEEG {
16 
17  inline std::string
18  getFilenameExtension(const std::string& name) {
19  const std::string ext = std::filesystem::path(name).extension().string();
20  if (ext=="")
21  return "";
22  return ext.substr(1);
23  }
24 
25  inline std::string
26  tolower(const std::string& s) {
27  std::string res = s;
28  std::transform(res.begin(),res.end(),res.begin(),
29  [](unsigned char c){ return static_cast<unsigned char>(std::tolower(c)); });
30  return res;
31  }
32 }
std::string tolower(const std::string &s)
Definition: filenames.h:26
std::string getFilenameExtension(const std::string &name)
Definition: filenames.h:18