xbString Methods
Chapter Updated 8/20/03
Method | Description |
---|---|
xbString() | Class Constructor |
xbString(size_t size) | Constructor, allocates space of size |
xbString(char c) | Constructor, initialized to char c |
xbString(const char *s) | Constructor, initialized to string s |
xbString(const char *s, size_t maxlen | Constructor, initialized to string s, with minimal string buf size of max_len |
xbString(const xbString &s) | Constructor, initialized to string s |
~xbString() | Class Destructor |
const char operator*() | Returns data |
char operator[](int n) | Returns char in position n |
xbString &operator=(const xbString &s) xbString &operator=(const char *s) xbString &operator=(char c) | Set string to s or c. |
xbString &operator+=(const char *s) xbSting &operator+=(char c) | Concatonate data to string |
xbString &operator-=(const char *s) xbSting &operator+=(char c) | Concatonate data and eliminate spaces between strings. |
bool operator==(const xbString &) | Compare string == |
bool operator!=(const xbString &) | Compare string != |
bool operator<(const xbString &s) | Compare string < |
bool operator>(const xbString &s) | Compare string > |
bool operator<=(const xbString &s) | Compare string <= |
bool operator<=(const xbString &s) | Compare string >= |
xbString addBackSlash( char c ) | Prefixes all char c with a backslash. |
xbString& assign(const xbString& str, size_t pos = 0, int len = 1) | Assign data in str starting at position pos for a length of len and return a reference. |
xbString& assign(const xbString& str, int len ) | Assign data in str for a length of len and return a reference. |
xbString copy() const | Used to copy a string |
const char * c_str() const | Returns the string or NULL if string is null. Depreciated function. |
int countChar( char c ) const | Returns the count of char c. |
int cvtHexChar( char & out ) | Converts a four byte string in the format of 0x00 to a one byte char value out. Returns 0 on success, -1 on error. |
int cvtHexString( zbString & out ) | Converts a string of four byte groupings in the format of 0x00 to a string of one byte characters out. Returns 0 on success, -1 on error. |
char getCharacter( int n ) const | Returns the character as position n. |
const char *getdata() const | Returns the string |
bool hasAlphaChars() const | Returns true is string contains any alpha characters, otherwise returns false. |
bool isEmpty() const | Returns true if the string has no memory allocated, or memory allocated is a zero byte string, otherwise returns false |
bool isNull() const | Returns true if the string has no memory allocated for the string, otherwise returns false |
size_t len() const size_t length() const | Returns length of string. It does not include the null terminating byte. |
xbString mid( size_t pos, int len ) | Pull a string of data out of another string of data, starting at position pos for a length of len. |
void ltrunc( size_t cnt ) | Left truncate the string cnt bytes. |
int pos(char c) | Locate character in string |
int pos(const char *s) | Locate string s in string |
void swapChars(char from, char to) | Swap character from to character to. |
void putAt(size_t pos, char c) | Put character c at position pos |
void remove( size_t pos = 0, int len ) | Remove data from the string to starting at pos for a lenght of len. |
void setNum(long num) | This method sets the string to the numeric value num. |
xbString &sprintf(const char * format, ... ) | Used to format a string. See the standard C printf function for formatting details. Internal 256 byte buffer which can be overflowed. |
void toLowerCase() | Converts string to lower case |
void toUpperCase() | Converts string to upper case |
void trim() | trim trailing spaces |
void zapChar( char c ) | Remove all instances of c from the string. |
void zapLeadingChar( char c ) | Left truncate all of c from the string. |
xbString operator-(const xbString &s1, const xbString &s2) | Concatonate two strings together, eliminate spaces |
xbString operator+(const xbString &s1, const xbString &s2) xbString operator+(const xbString &s1, const char *s2) xbString operator+(const char *s1, const xbString &s2) xbString operator+(const xbString &s1, char c2) xbString operator+(char c1, const xbString &s2) | Concatonate two strings together |
bool operator==(const xbString &, const char *) | Compare string == |
bool operator!=(const xbString &, const char *) | Compare string != |