StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ChapiStringUtilities.h
1 
7 #ifndef ChapiStringUtilities_h
8 #define ChapiStringUtilities_h
9 #include <vector>
10 #include <map>
11 #include <sstream>
12 #include <iostream>
13 
14 namespace chapi_string_utilities
15 {
16 
17  /* the third parameter of from_string() should be
18  one of std::hex, std::dec or std::oct. See
19 http://www.codeguru.com/forum/showthread.php?t=231054
20  */
21 
22 template <class T>
23 bool from_string(T& t,
24  const std::string& s,
25  std::ios_base& (*f)(std::ios_base&))
26  {
27  std::istringstream iss(s);
28  return !(iss >> f >> t).fail();
29  }
30 
31  extern std::vector<std::string> slice(std::string A, std::string sep);
32  extern std::map<std::string,std::string> associate_pieces(std::vector<std::string> v, std::string sep);
33  extern void cut_string_after_sub(std::string& input, const std::string& sub);
34  extern bool good_character(char* src);
35  extern std::string filter_string(char* src);
36 }
37 #endif