#include <config.h>
#include <algorithm>
+
+#ifdef __GLIBCPP__
+#include <ctype.h>
+#else
#include <cctype>
-#include <cstdio>
+#endif
#include <cstdlib>
#include "LString.h"
using std::count;
using std::transform;
+using std::tolower;
+using std::toupper;
+
int compare_no_case(string const & s, string const & s2)
{
// ANSI C
return 1;
}
+
int compare_no_case(string const & s, string const & s2, unsigned int len)
{
//#warning verify this func please
return 1;
}
+
bool isStrInt(string const & str)
{
if (str.empty()) return false;
string lowercase(string const & a)
{
string tmp(a);
- transform(tmp.begin(), tmp.end(), tmp.begin(), tolower);
+//#ifdef __GLIBCPP__
+ string::iterator result = tmp.begin();
+ for (string::iterator first = tmp.begin();
+ first != tmp.end(); ++first, ++result) {
+ *result = tolower(*first);
+ }
+//#else
+// transform(tmp.begin(), tmp.end(), tmp.begin(), tolower);
+//#endif
return tmp;
}
string uppercase(string const & a)
{
string tmp(a);
- transform(tmp.begin(), tmp.end(), tmp.begin(), toupper);
+//#ifdef __GLIBCPP__
+ string::iterator result = tmp.begin();
+ for (string::iterator first = tmp.begin();
+ first != tmp.end(); ++first, ++result) {
+ *result = toupper(*first);
+ }
+//#else
+// transform(tmp.begin(), tmp.end(), tmp.begin(), toupper);
+//#endif
return tmp;
}
-string tostr(long i)
-{
- // should use string stream
- char str[30];
- sprintf(str, "%ld", i);
- return string(str);
-}
-
-
-string tostr(unsigned long i)
-{
- // should use string stream
- char str[30];
- sprintf(str, "%lu", i);
- return string(str);
-}
-
-
-string tostr(void * v)
-{
- return tostr(long(v));
-}
-
-
-string tostr(int i)
-{
- return tostr(long(i));
-}
-
-
-string tostr(unsigned int ui)
-{
- return tostr(long(ui));
-}
-
-
-string tostr(char c)
-{
- return string(1, c);
-}
-
-
-string tostr(bool b)
-{
- return b ? "true" : "false";
-}
-
-
-string tostr(double d)
-{
- // should use string stream
- char tmp[40];
- sprintf(tmp, "%f", d);
- return string(tmp);
-}
-
-
bool prefixIs(string const & a, char const * pre)
{
unsigned int l = strlen(pre);