#include <vdkstring.h>
VDKString::VDKString | ( | ) |
Constructor, makes an empty string
VDKString s;
VDKString::VDKString | ( | const char * | s | ) |
Constructor
s | a null terminated C string VDKString s = "uncle bill"; |
VDKString::VDKString | ( | const char & | c | ) |
Constructor
c | a single character VDKString s(c); |
VDKString::VDKString | ( | const VDKString & | s | ) |
VDKString::~VDKString | ( | ) |
Destructor
VDKString & VDKString::operator= | ( | const char * | s | ) |
Assignement operator
s | a null terminated C string VDKString s = "uncle bill"; s = "uncle sam"; |
VDKString::operator char * | ( | ) | [inline] |
VDKString to char* casting warning ** can violate data hiding OO concept
int VDKString::operator== | ( | const VDKString & | s | ) | const |
Equality operator
int VDKString::operator< | ( | const VDKString & | s | ) | const |
less than operator
int VDKString::operator> | ( | const VDKString & | s | ) | const |
greater than operator
int VDKString::operator<= | ( | const VDKString & | s | ) | const |
less-equal operator
int VDKString::operator>= | ( | const VDKString & | s | ) | const |
greater-equal operator
int VDKString::operator!= | ( | const VDKString & | s | ) | const |
disequality operator
VDKString & VDKString::operator+= | ( | const char * | s | ) |
cat to this
s | a null terminated string VDKString s = "uncle bill"; s += " is a smart boy"; |
VDKString VDKString::operator+ | ( | const char * | s | ) | const |
bool VDKString::isNull | ( | ) | const |
Returns true if this is an empty string
int VDKString::size | ( | ) | const |
as strlen()
char VDKString::operator[] | ( | unsigned int | ix | ) | const |
index operator for const instances returns NULL if ix >= size
const char * VDKString::c_str | ( | ) | const |
string pointer access for const instances
VDKString & VDKString::DelSelection | ( | unsigned int | begin, | |
unsigned int | len | |||
) |
Removes a part of the string, beginning at 'begin' on 'len' length. Modifies and returns the resulting VDKString.
begin | char number where begins the selection (0 based) | |
len | selection length |
VDKString & VDKString::RTrim | ( | ) |
Removes all trailing spaces. Modifies and returns the resulting VDKString.
VDKString & VDKString::LTrim | ( | ) |
Removes all leading spaces. Modifies and returns the resulting VDKString.
VDKString & VDKString::Trim | ( | ) |
Removes all leading and trailing spaces. Modifies and returns the resulting VDKString.
unsigned int VDKString::CharCount | ( | const char | car | ) | const |
VDKString & VDKString::UpperCase | ( | ) |
Returns the upper case VDKString after having modify it.
Upper case characters are assumed without accents.
VDKString & VDKString::LowerCase | ( | ) |
Returns the lower case VDKString after having modify it.
bool VDKString::isEmpty | ( | ) | const |
Returns true if this is an empty string meaning NULL buffer or strlen() == 0.
VDKString & VDKString::Concatf | ( | const char * | format, | |
... | ||||
) |
Strcat() to the existing string (printf style). Modifies and returns the resulting VDKString.
Returns the previous string in case of memory overflow or buffer overflow.
format | a NULL terminated string | |
... | a list of parameters |
VDKString & VDKString::Sprintf | ( | const char * | format, | |
... | ||||
) |
Assignment to string (printf style). Modifies and returns the resulting VDKString.
Returns the previous string in case of memory overflow or buffer overflow.
format | a NULL terminated string | |
... | a list of parameters |
VDKString & VDKString::GetPart | ( | unsigned int | i, | |
const char | sep = '|' | |||
) |
int VDKString::GetFCharPos | ( | const char | car | ) | const |
Returns the first occurrence position of the specified char 'car' (0 based) or -1 if 'car ' not found.
car | char to be searched for |
int VDKString::GetLCharPos | ( | const char | car | ) | const |
Returns the last occurrence position of the specified char 'car' (0 based) or -1 if 'car ' not found.
car | char to be searched for |
double VDKString::StrtoDouble | ( | ) | const |
Returns the converted string to double. See atof() for details.
int VDKString::StrtoInt | ( | ) | const |
Returns the converted string to int. See atoi() for details.
VDKString & VDKString::SubStr | ( | unsigned int | start, | |
unsigned int | len | |||
) |
Extract a part of the string beginning at 'start' upon 'len' length. Modifies and returns the resulting VDKString.
start | first char position (0 based) | |
len | maximum length of the resulting string |
VDKString & VDKString::Cut | ( | unsigned int | len | ) |
Cut the string at 'len' length. Modifies and returns the resulting VDKString.
len | length of the resulting string |
VDKString & VDKString::LPad | ( | unsigned int | len, | |
const char | car | |||
) |
Pad left of string with a specified char 'car' upon 'len' length. Modifies and returns the resulting VDKString.
len | length of the resulting string | |
car | char to be padded |
VDKString & VDKString::RPad | ( | unsigned int | len, | |
const char | car | |||
) |
Pad right of string with a specified char 'car' upon 'len' length. Modifies and returns the resulting VDKString.
len | length of the resulting string | |
car | char to be padded |
VDKString & VDKString::DoubleChar | ( | const char | car = '\'' |
) |
VDKString & VDKString::FormatDate | ( | const char | sep, | |
int | orig, | |||
int | ret | |||
) |
Returns a VDKString containing a formatted date according to parameters settings. Modifies and returns the resulting VDKString.
sep | desired separator. If 0, no separator left | |
orig | date style staying in VDKString buffer | |
ret | date style to return VDKString s = "12/25/2000"; VDKString p = s; p.FormatDate(0, ENG_DATE, INT_DATE); // p value is "20001225" VDKString s = "12/25/2000"; VDKString p = s; p.FormatDate('-', ENG_DATE, EUR_DATE); // p value is "25-12-2000" |