cloudy  trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
service.h
Go to the documentation of this file.
1 /* This file is part of Cloudy and is copyright (C)1978-2017 by Gary J. Ferland and
2  * others. For conditions of distribution and use see copyright notice in license.txt */
3 
4 #ifndef SERVICE_H_
5 #define SERVICE_H_
6 
7 #include <string>
8 #include <vector>
9 
17 
18 // remove whitespace from the end of a string
19 void trimTrailingWhiteSpace( std::string &str );
20 // remove whitespace form the end of a char array
21 void trimTrailingWhiteSpace( char *str );
22 
24 void Split(const std::string& str, // input string
25  const std::string& sep, // separator, may be multiple characters
26  std::vector<std::string>& lst, // the separated items will be appended here
27  split_mode mode); // see above
28 
29 inline bool FindAndReplace(string& str,
30  const string& substr,
31  const string& newstr)
32 {
33  string::size_type ptr = str.find( substr );
34  if( ptr != string::npos )
35  str.replace( ptr, substr.length(), newstr );
36  return ptr != string::npos;
37 }
38 
39 inline bool FindAndErase(string& str,
40  const string& substr)
41 {
42  return FindAndReplace( str, substr, "" );
43 }
44 
45 void service(double tau, double a, double beta);
46 
47 #endif /* SERVICE_ */
bool FindAndErase(string &str, const string &substr)
Definition: service.h:39
split_mode
Definition: service.h:16
void trimTrailingWhiteSpace(string &str)
Definition: service.cpp:155
void service(double tau, double a, double beta)
void Split(const string &str, const string &sep, vector< string > &lst, split_mode mode)
Definition: service.cpp:108
bool FindAndReplace(string &str, const string &substr, const string &newstr)
Definition: service.h:29