bool t_Str::operator!=(const t_Str &s1) const { if(compare(s1.getText()) != 0) return true; return false; }
void t_Str::copy(const t_Str &original) { clear(); if(original.getLength() < minsize) { content.ministring.length = (unsigned)original.getLength(); memmove(content.ministring.text, original.getText(), original.getLength() + 1); content.ministring.big = false; return; } // ptr = original.getText(); content.bigstring.length = original.getLength(); content.bigstring.size = setSize(original.getLength() + 1); content.bigstring.text = getSpace(content.bigstring.size); content.ministring.big = true; memmove(content.bigstring.text, original.getText(), original.getLength() + 1); }
t_Str::t_Str(const t_Str &str, size_t start, size_t chars) { init(); char *ptr = str.getText(); size_t len = str.getLength(); if(start >= len) return; ptr += start; len -= start; if(chars >= len) chars = len; set(ptr, chars); }
int strprintf(t_Str &str, size_t size, const char *format, ...) { va_list args; va_start(args, format); int rtn; if(!size) size = str.getSize(); if(size > str.getSize()) str.resize(size); char *ptr = str.getText(); str.setLength(0); ptr[0] = 0; rtn = vsnprintf(ptr, size, format, args); str.setLength(strlen(ptr)); va_end(args); return rtn; }
bool t_Str::operator*=(const t_Str &s1) const { return search(s1.getText(), s1.getLength()) != npos; }
size_t t_Str::rfind(const t_Str &str, size_t ind) const { return rfind(str.getText(), ind, str.getLength()); }
size_t t_Str::find(const t_Str &str, size_t ind, unsigned instance) const { return find(str.getText(), ind, str.getLength(), instance); }
unsigned t_Str::count(const t_Str &str, size_t ind) const { return count(str.getText(), ind, str.getLength()); }
void t_Str::append(const t_Str &str) { append(str.getText(), str.getLength()); }
void t_Str::set(const t_Str &str) { set(str.getText(), str.getLength()); }
void t_Str::insert(size_t start, const t_Str &s) { insert(start, s.getText(), s.getLength()); }