-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsuUtility.h
More file actions
executable file
·39 lines (29 loc) · 1.16 KB
/
suUtility.h
File metadata and controls
executable file
·39 lines (29 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef SU_UTILITY_H
#define SU_UTILITY_H
#include <algorithm>
#include <string>
/*!
\brief Supplementary classes to be used mostly in combination with STL objects.
This namespace contains elements that mostly depend on STL objects. It's intention is
to provide an archive of small helper classes, functions and function objects that
are closely tied to the C++ standard library. Some of the classes are written by me,
others have been taken from books or the internet.
\warning
Changes and additions of functions that are project specific are not allowed here!
*/
namespace su
{
std::string trim_left (const std::string &a_str, const std::string &a_chars=" ");
std::string trim_right (const std::string &a_str, const std::string &a_chars=" ");
std::string trim(const std::string &a_str, const std::string &a_chars=" ");
std::string unquote(std::string &a_str);
template<typename TStr>
TStr to_upper(TStr a_sInput)
{
TStr sOutput(a_sInput);
int (*pf)(int) = toupper;
std::transform(sOutput.begin(), sOutput.end(), sOutput.begin(), pf);
return sOutput;
}
} // end of namespace string utils
#endif