Many functions in Str accept char* inputs. These functions include:
bool equals(const char* cstr) const;
bool startsWith(const char* cstr) const;
inline bool endsWith(const char* cstr) const;
inline void append(const char* cstr);
inline void insert(const char* cstr, unsigned long idx);
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,
Str &operator=(const char* cstr);
operator const char* () const { return data; }
Note that some functions, such as strip(), only accept char*
inputs (i.e. there is no Str& form). In this case, the automatic
char* cast will automatically apply. This means that you can
pass a Str object to strip() and similar functions without
problems.
In the case where there is a separate Str& function
defined in Str.hpp, such as equals(), it is usually
because there is extra performance benefit from passing in a Str
over a char*. In the case of equals, the function can
quickly return false if the two string lengths are not equal.