LiteSQL 0.3.10
string.hpp
Go to the documentation of this file.
1/* LiteSQL
2 *
3 * The list of contributors at http://litesql.sf.net/
4 *
5 * See LICENSE for copyright information. */
6
9#ifndef litesql_string_hpp
10#define litesql_string_hpp
11
12#include <string>
13#include <sstream>
14namespace litesql {
17template <class T>
18std::string toString(T a) {
19 std::ostringstream ost;
20 ost << a;
21 return ost.str();
22}
23
25bool startsWith(const std::string& what, const std::string& with);
27bool endsWith(const std::string& what, const std::string& with);
29std::string toLower(std::string s);
31std::string toUpper(std::string s);
32
33std::string capitalize(const std::string& s);
34std::string decapitalize(const std::string& s);
35
36
38std::string rstrip(std::string s);
40std::string lstrip(std::string s);
42std::string replace(const std::string& s, const std::string& what, const std::string& with);
44int hexToInt(const std::string& s);
46int atoi(const std::string &s);
48std::string operator*(int amount, const std::string &s);
50std::string operator*(const std::string &s, int amount);
53std::string escapeSQL(const std::string &str);
54}
55
56#endif
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
std::string lstrip(std::string s)
returns a string with no empty characters at the beginning of the string
std::string rstrip(std::string s)
returns a string with no empty characters at the end of the string
std::string replace(const std::string &s, const std::string &what, const std::string &with)
returns a copy string 's' where 'what' is replaced with 'with'
std::string toString(T a)
returns string representation of passed parameter if it can be written to ostringstream
Definition string.hpp:18
int hexToInt(const std::string &s)
converts string representation of a hex number to integer
int atoi(const std::string &s)
string version of atoi
bool endsWith(const std::string &what, const std::string &with)
returns true if 'what' end with 'with'
std::string toLower(std::string s)
returns lower-case version of the string
std::string operator*(int amount, const std::string &s)
returns a string which is duplicated 'amount' times
Definition string.cpp:101
std::string escapeSQL(const std::string &str)
escapes ' characters so that they do not break SQL statements.
bool startsWith(const std::string &what, const std::string &with)
returns true if 'what' starts with 'with'
std::string toUpper(std::string s)
returns upper-case version of the string

SourceForge.net Logo