41 #ifdef CHECK_MEMORY_LEAKS
43 #endif // CHECK_MEMORY_LEAKS
57 const size_t endpos = str.find_last_not_of(
" \t\n\r");
58 if (std::string::npos != endpos) {
59 const size_t startpos = str.find_first_not_of(
" \t\n\r");
60 return str.substr(startpos, endpos - startpos + 1);
68 for (
size_t i = 0; i < str.length(); i++) {
69 if (str[i] >=
'A' && str[i] <=
'Z') {
70 str[i] = str[i] +
'a' -
'A';
81 for (
size_t i = 0; i < str.length(); i++) {
82 const unsigned char c = str[i];
86 result += (char)(0xc2 + (c > 0xbf));
87 result += (char)((c & 0x3f) + 0x80);
96 str =
replace(str,
"\xE4",
"ae");
97 str =
replace(str,
"\xC4",
"Ae");
98 str =
replace(str,
"\xF6",
"oe");
99 str =
replace(str,
"\xD6",
"Oe");
100 str =
replace(str,
"\xFC",
"ue");
101 str =
replace(str,
"\xDC",
"Ue");
102 str =
replace(str,
"\xDF",
"ss");
103 str =
replace(str,
"\xC9",
"E");
104 str =
replace(str,
"\xE9",
"e");
105 str =
replace(str,
"\xC8",
"E");
106 str =
replace(str,
"\xE8",
"e");
115 const std::string what_tmp(what);
116 const std::string by_tmp(by);
117 size_t idx = str.find(what);
118 const size_t what_len = what_tmp.length();
120 const size_t by_len = by_tmp.length();
121 while (idx != std::string::npos) {
122 str = str.replace(idx, what_len, by);
123 idx = str.find(what, idx + by_len);
132 std::ostringstream oss;
138 sprintf(buffer,
"%02i:", (time / 3600));
141 sprintf(buffer,
"%02i:", (time / 60));
144 sprintf(buffer,
"%02i", time);
152 std::string result =
replace(orig,
"&",
"&");
153 result =
replace(result,
">",
">");
154 result =
replace(result,
"<",
"<");
155 result =
replace(result,
"\"",
""");
156 for (
char invalid =
'\1'; invalid <
' '; invalid++) {
157 result =
replace(result, std::string(1, invalid).c_str(),
"");
159 return replace(result,
"'",
"'");
static std::string escapeXML(const std::string &orig)
Replaces the standard escapes by their XML entities.
static std::string toTimeString(int time)
Builds a time string (hh:mm:ss) from the given seconds.
static std::string latin1_to_utf8(std::string str)
Transfers from Latin 1 (ISO-8859-1) to UTF-8.
static std::string convertUmlaute(std::string str)
Converts german "Umlaute" to their latin-version.
static std::string emptyString
An empty string.
static std::string replace(std::string str, const char *what, const char *by)
static std::string to_lower_case(std::string str)
Transfers the content to lower case.
static std::string prune(const std::string &str)
Removes trailing and leading whitechars.