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); }
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); }
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()); }