#include <stdio.h>
#include <ctype.h>
#include <assert.h>
-//#include "globals.hh"
+
#include "string.hh"
+
static char* strlwr( char* s )
{
char* p = s;
// String convd to const char *
}
- const char*
-String::ptr() const
+const char*
+String::cptr() const
{
return data;
}
-#ifdef CENTRAL_OBJECT // everything derived from Sortable object
-// comparisons.
-int
-String::operator ==( const Sortable& test ) const
-{
- const String *s = (const String *) &test;
- return *this == *s;
-}
-
-int
-String::operator &&(const Object& test) const
-{
- const String *s = (const String *) &test;
-
- int i = min( len(), s->len() );
- return ( i > 0 ) ?
- ( !strncmp( data, s->data, i ) ) : 0;
-}
-
-int
-String::operator >( const Sortable& test ) const
-{
- const String *s = (const String *) &test;
- return strcmp( data, s->data ) > 0;
-}
-#endif
-
// signed comparison, analogous to strcmp;
int
String::compare( const char* test ) const
strrev(s);
return retval;
}
-bool
-String::to_bool() const
-{
- if (!len())
- return false;
- if (*this == "0")
- return false;
- String u (*this);
- u.upper();
- if (u== "FALSE")
- return false;
- return true;
-}