#include <rlstring.h>
Public Member Functions | |
| rlString (const char *text="") | |
| rlString (rlString &text) | |
| rlString (rlString *text) | |
| virtual | ~rlString () |
| rlString & | operator= (const char *s2) |
| rlString & | operator= (rlString &s2) |
| rlString & | operator+ (const char *s2) |
| rlString & | operator+ (rlString &s2) |
| rlString & | operator+= (const char *s2) |
| rlString & | operator+= (rlString &s2) |
| char * | text () |
| int | setText (const char *text) |
| int | printf (const char *format,...) |
| int | cat (const char *text) |
| int | upper () |
| int | lower () |
| int | startsWith (const char *startstr) |
| int | strnocasecmp (const char *other) |
| int | strnnocasecmp (const char *other, int n) |
| char * | strstr (const char *substring) |
| char * | strchr (int c) |
| char * | strrchr (int c) |
Private Attributes | |
| char * | txt |
class for a simple ANSI-C like string.
Definition at line 25 of file rlstring.h.
| rlString::rlString | ( | const char * | text = "" |
) |
| rlString::rlString | ( | rlString & | text | ) |
| rlString::rlString | ( | rlString * | text | ) |
| rlString::~rlString | ( | ) | [virtual] |
destruct the string
Definition at line 39 of file rlstring.cpp.
00040 { 00041 delete [] txt; 00042 }
| int rlString::cat | ( | const char * | text | ) |
| int rlString::lower | ( | ) |
converst string to upper case
Definition at line 132 of file rlstring.cpp.
00133 { 00134 return ::rllower(txt); 00135 }
| rlString & rlString::operator+ | ( | const char * | s2 | ) |
Definition at line 56 of file rlstring.cpp.
00057 { 00058 this->cat(s2); 00059 return *this; 00060 }
| rlString & rlString::operator+= | ( | const char * | s2 | ) |
Definition at line 68 of file rlstring.cpp.
00069 { 00070 this->cat(s2); 00071 return *this; 00072 }
| rlString & rlString::operator= | ( | const char * | s2 | ) |
Definition at line 44 of file rlstring.cpp.
00045 { 00046 this->setText(s2); 00047 return *this; 00048 }
| int rlString::printf | ( | const char * | format, | |
| ... | ||||
| ) |
printf the text
Definition at line 94 of file rlstring.cpp.
00095 { 00096 int ret; 00097 char mystring[rl_PRINTF_LENGTH]; // should be big enough 00098 00099 va_list ap; 00100 va_start(ap,format); 00101 ret = rlvsnprintf(mystring, rl_PRINTF_LENGTH - 1, format, ap); 00102 va_end(ap); 00103 if(ret < 0) return ret; 00104 delete [] txt; 00105 txt = new char [strlen(mystring)+1]; 00106 ::strcpy(txt, mystring); 00107 return ret; 00108 }
| int rlString::setText | ( | const char * | text | ) |
| int rlString::startsWith | ( | const char * | startstr | ) |
test if string starts with startstr
Definition at line 137 of file rlstring.cpp.
00138 { 00139 return ::rlStartsWith(txt,startstr); 00140 }
| char * rlString::strchr | ( | int | c | ) |
| int rlString::strnnocasecmp | ( | const char * | other, | |
| int | n | |||
| ) |
| int rlString::strnocasecmp | ( | const char * | other | ) |
| char * rlString::strrchr | ( | int | c | ) |
strchr()
Definition at line 167 of file rlstring.cpp.
00168 { 00169 return ::strrchr(txt,c); 00170 }
| char * rlString::strstr | ( | const char * | substring | ) |
strstr()
Definition at line 121 of file rlstring.cpp.
00122 { 00123 if(substring == NULL) return NULL; 00124 return ::strstr(txt,substring); 00125 }
| char * rlString::text | ( | ) |
| int rlString::upper | ( | ) |
converst string to upper case
Definition at line 127 of file rlstring.cpp.
00128 { 00129 return ::rlupper(txt); 00130 }
char* rlString::txt [private] |
Definition at line 110 of file rlstring.h.