SusyNtuple
SusyNtuple/string_utils.h
00001 // Dear emacs, this is -*- c++ -*-
00002 #ifndef SUSY_STRING_UTILS_H
00003 #define SUSY_STRING_UTILS_H
00004 
00005 /*
00006   String manipulation utility functions
00007 
00008   Mostly useful to parse text files.
00009 
00010   davide.gerbaudo@gmail.com
00011   June 2014
00012 */
00013 
00014 #include <string>
00015 #include <vector>
00016 
00017 namespace Susy{
00018 namespace utils{
00019 
00020 typedef std::vector< std::string > vstring_t;
00021 
00023 std::string rmLeadingTrailingWhitespaces(const std::string &str);
00025 std::string multipleSpaces2singleSpace(std::string str);
00027 std::string commandLineArguments(int argc, char **argv);
00029 std::string tab2space(std::string str);
00031 bool contains(const std::string &str, const std::string &substr);
00033 bool endswith(const std::string &str, const std::string &ending);
00035 std::vector< std::string > tokenizeString(const std::string &inputString, char separator);
00037 double string2double(const std::string &s);
00039 double multiply(const std::string &str);
00041 bool isInt(const std::string& s);
00043 
00046 std::vector<std::string> filesFromDir(const std::string &dirname);
00047 
00048 } // utils
00049 } // susy
00050 #endif
 All Classes Functions Variables Typedefs Enumerations Enumerator