Below is a stripped-down version of Str.hpp that gives a tour of
functions available:
class Str {
public:
Str();
Str(const char* cstr);
Str(const Str& str);
Str(unsigned long size, bool time_efficient);
Str(char* buff, unsigned long buff_size, bool initialize=true,
bool deallocate=false);
~Str();
void resize(unsigned long new_size, bool allow_smaller=false);
inline void compact();
void setTimeEfficient(bool flag, bool fix_now=true);
inline bool isTimeEfficient() const;
inline unsigned long length() const;
inline unsigned long buffSize() const;
inline bool equals(const Str& str) const;
bool equals(const char* cstr) const;
inline bool startsWith(const Str& str) const;
bool startsWith(const char* cstr) const;
inline bool endsWith(const char* cstr) const;
inline bool endsWith(const Str& str) const;
inline void append(const char* cstr);
inline void append(const Str& str);
void cut(unsigned long start_idx, unsigned long end_idx);
void copyRange(const Str& str, unsigned long start_idx,
unsigned long end_idx);
inline void insert(const char* cstr, unsigned long idx);
inline void insert(const Str& str, unsigned long idx);
inline void replaceRange(unsigned long start_idx,
unsigned long end_idx, const char* cstr);
inline void replaceRange(unsigned long start_idx,
unsigned long end_idx, const Str& str);
void format(const char* templ, ...);
inline void strip(const char* whitespace_set=0);
inline void lstrip(const char* whitespace_set=0);
inline void rstrip(const char* whitespace_set=0);
unsigned int countTokens(unsigned long start_idx=0,
const char* white_space_set=0) const;
long copyToken(const Str& str, long start_idx=0,
const char* white_space_set=0);
Str* getAllTokens(unsigned int& token_count,
const char* white_space_set=0) const;
long findNext(const char* str, unsigned long start_position=0) const;
unsigned long count(const char* str,
unsigned long start_position=0) const;
unsigned long replace(const char* old_str, const char* new_str,
unsigned long start_position=0,
bool replace_all=true);
void upper();
void lower();
char* detach(unsigned long& buff_size, bool& allocated);
void attach(char* buff, unsigned long buff_size,
bool initialize=true,
bool deallocate=false);
Str &operator=(const char* cstr);
Str &operator=(const Str& str);
inline char getChar(unsigned long idx);
inline char setChar(unsigned long idx, char c);
operator const char* () const { return data; }
friend ostream &operator<<(ostream &stream, Str& str);
friend istream &operator>>(istream &stream, Str& str);
};