From bfa5de7eccf4604ff8217f619e9685a09e80d545 Mon Sep 17 00:00:00 2001 From: Pixel Date: Fri, 27 Sep 2002 12:17:57 +0000 Subject: The week-without-the-network changes --- generic/String.cpp | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'generic/String.cpp') diff --git a/generic/String.cpp b/generic/String.cpp index 24961c5..d879308 100644 --- a/generic/String.cpp +++ b/generic/String.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include "String.h" #include "Exceptions.h" #ifdef HAVE_CONFIG_H @@ -27,14 +28,13 @@ String::String(char c) : siz(1) { str = t; } -#if 0 String::String(const char * s) : str(Base::strdup(s)), siz(::strlen(str)) { #ifdef DEBUG fprintf(stderr, "Creating a string with `%s' at %p\n", str, str); #endif } -#endif +#if 0 String::String(const char * s, ...) { va_list ap; @@ -42,14 +42,13 @@ String::String(const char * s, ...) { fprintf(stderr, "Creating a String with s = '%s'\n", s); #endif -/* This causes a warning: cannot pass objects of type `const String' through `...' - but it is not really a problem. */ va_start(ap, s); vsnprintf(t, BUFSIZ, s, ap); str = Base::strdup(t); va_end(ap); siz = ::strlen(str); } +#endif String::String(int hs, const char * s) : str(s ? Base::strdup(s) : Base::strdup("")), siz(hs) { } @@ -389,3 +388,19 @@ bool String::is_time(void) const { String operator+(const char * a, const String & b) { return String(a) + b; } + +String & String::toupper() { + for (int i = 0; i < strlen(); i++) { + str[i] = ::toupper(str[i]); + } + + return *this; +} + +String & String::tolower() { + for (int i = 0; i < strlen(); i++) { + str[i] = ::tolower(str[i]); + } + + return *this; +} -- cgit v1.2.3