1 //   OpenNN: Open Neural Networks Library
2 //   www.opennn.net
3 //
4 //   O P E N N N  S T R I N G S
5 //
6 //   Artificial Intelligence Techniques, SL
7 //   artelnics artelnics.com
8 
9 #ifndef OPENNNSTRINGS_H
10 #define OPENNNSTRINGS_H
11 
12 // System includes
13 
14 #include <math.h>
15 #include <regex>
16 #include <iostream>
17 
18 // Eigen includes
19 
20 #include "config.h"
21 
22 using namespace std;
23 using namespace Eigen;
24 
25 namespace OpenNN
26 {
27     Index count_tokens(const string&, const char&);
28 
29     Tensor<string, 1> get_tokens(const string&, const char&);
30     void fill_tokens(const string&, const char&, Tensor<string, 1>&);
31 
32     Tensor<type, 1> to_type_vector(const string&, const char&);
33 
34 //    inline bool is_digit_string(const char str) {return std::isdigit(str);}
35     bool is_numeric_string(const string&);
36     bool is_date_time_string(const string&);
37     bool is_constant_numeric(const Tensor<type, 1>&);
38     bool is_constant_string(const Tensor<string, 1>&);
39 
40     time_t date_to_timestamp(const string& date, const Index& gmt = 0);
41 
42     bool contains_substring(const string&, const string&);
43 
44     void trim(string&);
45     void erase(string&, const char&);
46 
47     string get_trimmed(const string&);
48 
49     string prepend(const string&, const string&);
50 
51     bool has_numbers(const Tensor<string, 1>&);
52     bool has_strings(const Tensor<string, 1>&);
53 
54     bool is_numeric_string_vector(const Tensor<string, 1>&);
55 
56     bool is_not_numeric(const Tensor<string, 1>&);
57     bool is_mixed(const Tensor<string, 1>&);
58 
59     void replace(string& source, const string& find, const string& replace);
60     void replace_substring(Tensor<string, 1>&, const string& , const string&);
61 }
62 
63 #endif // OPENNNSTRINGS_H
64