source: CONFIG_DEVT/LMDZOR_V6.2_work_ENSEMBLES/modeles/XIOS/src/string_tools.hpp @ 5477

Last change on this file since 5477 was 5477, checked in by aclsce, 4 years ago
  • Created CONFIG_DEVT directory
  • First import of LMDZOR_V6.2_work_ENSEMBLES working configuration
File size: 596 bytes
Line 
1#ifndef __STRING_TOOLS_HPP__
2#define __STRING_TOOLS_HPP__
3
4#include <string>
5#include <regex>
6#include <vector>
7
8namespace xios
9{
10  std::vector<std::string> splitRegex(const std::string& input, const std::string& regex) ;
11
12  inline std::vector<std::string> splitRegex(const std::string& input, const std::string& regex)
13  {
14      // passing -1 as the submatch index parameter performs splitting
15      std::regex re(regex);
16      std::regex_token_iterator<std::string::const_iterator>
17          first{input.begin(), input.end(), re, -1},
18          last;
19      return {first, last}; 
20  }
21
22}
23#endif
Note: See TracBrowser for help on using the repository browser.