QMCPACK
FileUtility.h
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////////////
2 // This file is distributed under the University of Illinois/NCSA Open Source License.
3 // See LICENSE file in top directory for details.
4 //
5 // Copyright (c) 2016 Jeongnim Kim and QMCPACK developers.
6 //
7 // File developed by: Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
8 // Jeremy McMinnis, jmcminis@gmail.com, University of Illinois at Urbana-Champaign
9 //
10 // File created by: Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
11 //////////////////////////////////////////////////////////////////////////////////////
12 
13 
14 #ifndef OHMMS_FILEUTILITY_H
15 #define OHMMS_FILEUTILITY_H
16 
17 #include <string_view>
18 
19 inline std::string_view getExtension(const std::string_view str)
20 {
21  size_t pos = str.find_last_of('.');
22  if (pos == std::string_view::npos)
23  return std::string_view();
24  return str.substr(pos + 1);
25 }
26 #endif
std::string_view getExtension(const std::string_view str)
Definition: FileUtility.h:19