MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
strutil.h
Go to the documentation of this file.
1 /*******************************************************************
2  * File: StringUtil.h
3  * Description: Some common utility functions for strings.
4  * Author: Subhasis Ray
5  * E-mail: ray.subhasis@gmail.com
6  * Created: 2007-09-25 12:08:00
7  ********************************************************************/
8 #ifndef _STRINGUTIL_H
9 #define _STRINGUTIL_H
10 
11 #include <string>
12 #include <vector>
13 
14 namespace moose
15 {
17  static const char* const DELIMITERS=" \t\r\n";
18 
20  void tokenize( const std::string& str,
21  const std::string& delimiters,
22  std::vector< std::string >& tokens
23  );
24 
26  std::string trim(const std::string myString, const std::string& delimiters=" \t\r\n");
27 
29  std::string fix(const std::string myString, const std::string& delimiters=" \t\r\n");
30 
31  std::string& clean_type_name(std::string& arg);
32  bool endswith(const std::string& full, const std::string& ending);
33 
49  int strncasecmp( const std::string& a, const std::string& b, size_t n);
50 
54  std::string random_string( const unsigned size );
55 }
56 
57 #endif //_STRINGUTIL_H
bool endswith(const string &full, const string &ending)
Definition: strutil.cpp:138
int strncasecmp(const string &a, const string &b, size_t n)
Compares the two strings a and b for first n characters, ignoring the case of the characters...
Definition: strutil.cpp:148
std::string fix(const std::string userPath, const string &delimiters)
Definition: strutil.cpp:71
string & clean_type_name(string &arg)
Definition: strutil.cpp:36
void tokenize(const string &str, const string &delimiters, vector< string > &tokens)
Definition: strutil.cpp:19
std::string trim(const std::string myString, const string &delimiters)
Definition: strutil.cpp:53
static const char *const DELIMITERS
Definition: strutil.h:17
string random_string(const unsigned len)
Definition: strutil.cpp:162