GGS(GenericGEANT4Simulation)Software  2.7.0
 All Data Structures Namespaces Files Functions Variables Typedefs Macros
GGSStringUtils.h
Go to the documentation of this file.
1 /*
2  * GGSStringUtils.h
3  *
4  * Created on: 10 Oct 2018
5  * Author: Nicola Mori
6  */
7 
10 #ifndef GGSSTRINGUTILS_H_
11 #define GGSSTRINGUTILS_H_
12 
13 #include <regex>
14 #include <string>
15 #include <vector>
16 
17 using Tokens = std::vector<std::string>;
18 
20 namespace GGSStringUtils {
21 
34 Tokens Tokenize(const std::string &str, char delimiter = ' ');
35 
43 std::string Trim(const std::string &str);
44 
52 bool IsInteger(const std::string &str);
53 
63 bool IsReal(const std::string &str);
64 
73 bool IsGlobExpression(const std::string &str);
74 
82 std::string RegexFromGlob(const std::string &str);
83 } // namespace GGSStringUtils
84 
85 #endif /* GGSSTRINGUTILS_H_ */
std::string RegexFromGlob(const std::string &str)
Build a regex starting from a glob expression.
Tokens Tokenize(const std::string &str, char delimiter= ' ')
Extracts words from a string.
bool IsGlobExpression(const std::string &str)
Check if the given string is a glob expression.
bool IsInteger(const std::string &str)
Checks if a string is an a integer.
bool IsReal(const std::string &str)
Checks if a string is a real number.
std::string Trim(const std::string &str)
Trims a string.