int compare_no_case(string const & s, string const & s2, unsigned int len)
{
-//#warning verify this func please
string::const_iterator p = s.begin();
string::const_iterator p2 = s2.begin();
unsigned int i = 0;
if (tmpstr.empty()) return false;
string::const_iterator cit = tmpstr.begin();
- if ( (*cit) == '-') ++cit;
+ if ((*cit) == '-') ++cit;
string::const_iterator end = tmpstr.end();
for (; cit != end; ++cit) {
if (!isdigit((*cit))) return false;
string::const_iterator cit = tmpstr.begin();
bool found_dot(false);
- if ( (*cit) == '-') ++cit;
+ if ((*cit) == '-') ++cit;
string::const_iterator end = tmpstr.end();
for (; cit != end; ++cit) {
if (!isdigit((*cit))
char lowercase(char c)
{
- return tolower(c);
+ return char( tolower(c) );
}
char uppercase(char c)
{
- return toupper(c);
+ return char( toupper(c) );
}
string const lowercase(string const & a)
{
string tmp(a);
-//#ifdef __GLIBCPP__
+#if 1
string::iterator result = tmp.begin();
string::iterator end = tmp.end();
for (string::iterator first = tmp.begin();
first != end; ++first, ++result) {
*result = lowercase(*first);
}
-//#else
-// transform(tmp.begin(), tmp.end(), tmp.begin(), tolower);
-//#endif
+#else
+ // We want to use this one. (Lgb)
+ transform(tmp.begin(), tmp.end(), tmp.begin(), tolower);
+#endif
return tmp;
}
string const uppercase(string const & a)
{
string tmp(a);
-//#ifdef __GLIBCPP__
+#if 1
string::iterator result = tmp.begin();
string::iterator end = tmp.end();
for (string::iterator first = tmp.begin();
first != end; ++first, ++result) {
*result = uppercase(*first);
}
-//#else
-// transform(tmp.begin(), tmp.end(), tmp.begin(), toupper);
-//#endif
+#else
+ // We want to use this one. (Lgb)
+ transform(tmp.begin(), tmp.end(), tmp.begin(), toupper);
+#endif
return tmp;
}
{
Assert(pre);
- unsigned int const l = strlen(pre);
+ size_t const l = strlen(pre);
string::size_type const alen = a.length();
if (l > alen || a.empty())
{
Assert(suf);
- unsigned int const suflen = strlen(suf);
+ size_t const suflen = strlen(suf);
if (suflen > a.length())
return false;
else {
string tmp(a, alen - suflen);
return ::strncmp(tmp.c_str(), suf.c_str(), suflen) == 0;
#else
- return a.compare(alen - suflen, suflen, suf);
+ return a.compare(alen - suflen, suflen, suf) == 0;
#endif
}
}
}
-unsigned int countChar(string const & a, char c)
+string::size_type countChar(string const & a, char c)
{
#ifdef HAVE_STD_COUNT
return count(a.begin(), a.end(), c);
string tmp(a);
string::iterator lit = tmp.begin();
string::iterator end = tmp.end();
- for(; lit != end; ++lit)
+ for (; lit != end; ++lit)
if ((*lit) == oldchar)
(*lit) = newchar;
return tmp;
string lstr(a);
string::size_type i = 0;
- int olen = strlen(oldstr);
+ string::size_type olen = strlen(oldstr);
while((i = lstr.find(oldstr, i)) != string::npos) {
lstr.replace(i, olen, newstr);
i += newstr.length(); // We need to be sure that we dont