EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PndStringSeparator.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PndStringSeparator.h
1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 #ifndef PNDSTRINGSEPARATOR_H
23 #define PNDSTRINGSEPARATOR_H
24 
25 #include <string>
26 #include <vector>
27 #include "Rtypes.h"
28 
29 
31 {
32  public :
35  PndStringSeparator(std::string AInput, std::string ADelimiter = " ");
36  void SetInput (std::string AInput) {fInput = AInput;};
37  void SetDelimiter (std::string ADelimiter) {fDelimiter = ADelimiter;};
38  void ResetVector(){fStrings.clear();};
39  std::vector<std::string> GetStringVector (void);
40  void TestFirst(){if(fInput.find_first_of(fDelimiter)==0) fFirstDel=true; else fFirstDel=false;}
41  void TestLast(){if(fInput.find_last_of(fDelimiter)==fInput.size()-1) fLastDel = true; else fLastDel = false;}
42  bool GetIfFirst(){return fFirstDel;}
43  bool GetIfLast(){return fLastDel;}
44  std::string Replace(std::string from, std::string to);
45  void Print();
46 
47  private :
48  std::string::size_type fStartPos;
49  std::vector<std::string> fStrings;
50  std::string fInput;
51  std::string fDelimiter;
52  std::string fOutput;
53  std::string GetString (void);
54  bool fFirstDel; //first element in the string was a delimiter
55  bool fLastDel; //last element in the string was a delimiter
56 };
57 
58 #endif