ROOT » CORE » BASE » TString

class TString


TString

Basic string class.

Cannot be stored in a TCollection... use TObjString instead.

The underlying string is stored as a char* that can be accessed via
TString::Data().
TString provides Short String Optimization (SSO) so that short
strings (<15 on 64-bit and <11 on 32-bit) are contained in the
TString internal data structure without the need for mallocing the
required space.

Substring operations are provided by the TSubString class, which
holds a reference to the original string and its data, along with
the offset and length of the substring. To retrieve the substring
as a TString, construct a TString from it, eg:
root [0] TString s("hello world")
root [1] TString s2( s(0,5) )
root [2] s2
(class TString)"hello"


Function Members (Methods)

public:
virtual~TString()
TString&Append(const char* cs)
TString&Append(const TString& s)
TString&Append(const char* cs, Ssiz_t n)
TString&Append(const TString& s, Ssiz_t n)
TString&Append(char c, Ssiz_t rep = 1)
Double_tAtof() const
Int_tAtoi() const
Long64_tAtoll() const
static TStringBaseConvert(const TString& s_in, Int_t base_in, Int_t base_out)
Bool_tBeginsWith(const char* s, TString::ECaseCompare cmp = kExact) const
Bool_tBeginsWith(const TString& pat, TString::ECaseCompare cmp = kExact) const
Ssiz_tCapacity() const
Ssiz_tCapacity(Ssiz_t n)
TString&Chop()
static TClass*Class()
voidClear()
intCompareTo(const char* cs, TString::ECaseCompare cmp = kExact) const
intCompareTo(const TString& st, TString::ECaseCompare cmp = kExact) const
Bool_tContains(const TRegexp& pat) const
Bool_tContains(TPRegexp& pat) const
Bool_tContains(const char* pat, TString::ECaseCompare cmp = kExact) const
Bool_tContains(const TString& pat, TString::ECaseCompare cmp = kExact) const
TStringCopy() const
Int_tCountChar(Int_t c) const
const char*Data() const
Bool_tEndsWith(const char* pat, TString::ECaseCompare cmp = kExact) const
Bool_tEqualTo(const char* cs, TString::ECaseCompare cmp = kExact) const
Bool_tEqualTo(const TString& st, TString::ECaseCompare cmp = kExact) const
virtual voidFillBuffer(char*& buffer) const
Ssiz_tFirst(char c) const
Ssiz_tFirst(const char* cs) const
voidForm(const char* fmt)
static TStringFormat(const char* fmt)
static Ssiz_tGetInitialCapacity()
static Ssiz_tGetMaxWaste()
static Ssiz_tGetResizeIncrement()
Bool_tGets(FILE* fp, Bool_t chop = kTRUE)
UInt_tHash(TString::ECaseCompare cmp = kExact) const
static UInt_tHash(const void* txt, Int_t ntxt)
Ssiz_tIndex(const TRegexp& pat, Ssiz_t i = 0) const
Ssiz_tIndex(TPRegexp& pat, Ssiz_t i = 0) const
Ssiz_tIndex(const char* pat, Ssiz_t i = 0, TString::ECaseCompare cmp = kExact) const
Ssiz_tIndex(const TString& s, Ssiz_t i = 0, TString::ECaseCompare cmp = kExact) const
Ssiz_tIndex(const TRegexp& pat, Ssiz_t* ext, Ssiz_t i = 0) const
Ssiz_tIndex(TPRegexp& pat, Ssiz_t* ext, Ssiz_t i = 0) const
Ssiz_tIndex(const char* pat, Ssiz_t patlen, Ssiz_t i, TString::ECaseCompare cmp) const
Ssiz_tIndex(const TString& s, Ssiz_t patlen, Ssiz_t i, TString::ECaseCompare cmp) const
static Ssiz_tInitialCapacity(Ssiz_t ic = 15)
TString&Insert(Ssiz_t pos, const char* s)
TString&Insert(Ssiz_t pos, const TString& s)
TString&Insert(Ssiz_t pos, const char* s, Ssiz_t extent)
TString&Insert(Ssiz_t pos, const TString& s, Ssiz_t extent)
virtual TClass*IsA() const
Bool_tIsAlnum() const
Bool_tIsAlpha() const
Bool_tIsAscii() const
Bool_tIsBin() const
Bool_tIsDec() const
Bool_tIsDigit() const
Bool_tIsFloat() const
Bool_tIsHex() const
Bool_tIsInBaseN(Int_t base) const
Bool_tIsNull() const
Bool_tIsOct() const
Bool_tIsWhitespace() const
static TStringItoa(Int_t value, Int_t base)
Ssiz_tLast(char c) const
Ssiz_tLength() const
static TStringLLtoa(Long64_t value, Int_t base)
static Ssiz_tMaxWaste(Ssiz_t mw = 15)
Bool_tMaybeRegexp() const
Bool_tMaybeWildcard() const
TStringMD5() const
string_viewoperator basic_string_view() const
const char*operator const char *() const
char&operator()(Ssiz_t i)
charoperator()(Ssiz_t i) const
TSubStringoperator()(const TRegexp& re) const
TSubStringoperator()(TPRegexp& re) const
TSubStringoperator()(Ssiz_t start, Ssiz_t len) const
TSubStringoperator()(const TRegexp& re, Ssiz_t start) const
TSubStringoperator()(TPRegexp& re, Ssiz_t start) const
TString&operator+=(const char* s)
TString&operator+=(const TString& s)
TString&operator+=(char c)
TString&operator+=(Short_t i)
TString&operator+=(UShort_t i)
TString&operator+=(Int_t i)
TString&operator+=(UInt_t i)
TString&operator+=(Long_t i)
TString&operator+=(ULong_t i)
TString&operator+=(Float_t f)
TString&operator+=(Double_t f)
TString&operator+=(Long64_t i)
TString&operator+=(ULong64_t i)
TString&operator=(char s)
TString&operator=(const char* s)
TString&operator=(const TString& s)
TString&operator=(const string& s)
TString&operator=(const string_view& s)
TString&operator=(const TSubString& s)
char&operator[](Ssiz_t i)
charoperator[](Ssiz_t i) const
TString&Prepend(const char* cs)
TString&Prepend(const TString& s)
TString&Prepend(const char* cs, Ssiz_t n)
TString&Prepend(const TString& s, Ssiz_t n)
TString&Prepend(char c, Ssiz_t rep = 1)
voidPuts(FILE* fp)
virtual voidReadBuffer(char*& buffer)
istream&ReadFile(istream& str)
istream&ReadLine(istream& str, Bool_t skipWhite = kTRUE)
istream&ReadString(istream& str)
static TString*ReadString(TBuffer& b, const TClass* clReq)
istream&ReadToDelim(istream& str, char delim = '\n')
istream&ReadToken(istream& str)
TString&Remove(Ssiz_t pos)
TString&Remove(Ssiz_t pos, Ssiz_t n)
TString&Remove(TString::EStripType s, char c)
TString&Replace(Ssiz_t pos, Ssiz_t n, const char* s)
TString&Replace(Ssiz_t pos, Ssiz_t n, const TString& s)
TString&Replace(Ssiz_t pos, Ssiz_t n, const char* s, Ssiz_t ns)
TString&Replace(Ssiz_t pos, Ssiz_t n1, const TString& s, Ssiz_t n2)
TString&ReplaceAll(const TString& s1, const TString& s2)
TString&ReplaceAll(const TString& s1, const char* s2)
TString&ReplaceAll(const char* s1, const TString& s2)
TString&ReplaceAll(const char* s1, const char* s2)
TString&ReplaceAll(const char* s1, Ssiz_t ls1, const char* s2, Ssiz_t ls2)
voidResize(Ssiz_t n)
static Ssiz_tResizeIncrement(Ssiz_t ri = 16)
virtual voidShowMembers(TMemberInspector& insp) const
virtual Int_tSizeof() const
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
TSubStringStrip(TString::EStripType s = kTrailing, char c = ' ') const
TSubStringSubString(const char* pat, Ssiz_t start = 0, TString::ECaseCompare cmp = kExact) const
TString&Swap(TString& other)
TObjArray*Tokenize(const TString& delim) const
Bool_tTokenize(TString& tok, Ssiz_t& from, const char* delim = " ") const
voidToLower()
voidToUpper()
TString()
TString(Ssiz_t ic)
TString(const TString& s)
TString(TString&& s)
TString(const char* s)
TString(const string& s)
TString(char c)
TString(const string_view& sub)
TString(const TSubString& sub)
TString(const char* s, Ssiz_t n)
TString(char c, Ssiz_t s)
static TStringUItoa(UInt_t value, Int_t base)
static TStringULLtoa(ULong64_t value, Int_t base)
static voidWriteString(TBuffer& b, const TString* a)
protected:
static Ssiz_tAdjustCapacity(Ssiz_t oldCap, Ssiz_t newCap)
static Ssiz_tAlign(Ssiz_t s)
voidAssertElement(Ssiz_t nc) const
voidClobber(Ssiz_t nc)
voidInitChar(char c)
static Ssiz_tRecommend(Ssiz_t s)
TString(const char* a1, Ssiz_t n1, const char* a2, Ssiz_t n2)
private:
voidClone(Ssiz_t nc)
voidFormImp(const char* fmt, va_list ap)
Ssiz_tGetLongCap() const
char*GetLongPointer()
const char*GetLongPointer() const
Ssiz_tGetLongSize() const
char*GetPointer()
const char*GetPointer() const
char*GetShortPointer()
const char*GetShortPointer() const
Ssiz_tGetShortSize() const
UInt_tHashCase() const
UInt_tHashFoldCase() const
char*Init(Ssiz_t capacity, Ssiz_t nchar)
Bool_tIsLong() const
static Ssiz_tMaxSize()
voidSetLongCap(Ssiz_t s)
voidSetLongPointer(char* p)
voidSetLongSize(Ssiz_t s)
voidSetShortSize(Ssiz_t s)
voidSetSize(Ssiz_t s)
voidUnLink() const
voidZero()

Data Members

public:
static TString::EStripTypekBoth
static TString::ECaseComparekExact
static TString::ECaseComparekIgnoreCase
static TString::EStripTypekLeading
static const Ssiz_tkNPOS
static TString::EStripTypekTrailing
protected:
TString::Rep_tfRep! String data
static TString::(anonymous)kAlignment
private:
static TString::(anonymous)kLongMask
static TString::(anonymous)kMinCap
static TString::(anonymous)kNwords
static TString::(anonymous)kShortMask

Class Charts

Inheritance Chart:
TString
TEveException
TGString
TGHotString
TStringLong
TStringToken

Function documentation

TString()
 TString default ctor.
TString(Ssiz_t ic)
 Create TString able to contain ic characters.
TString(const char* s)
 Create TString and initialize it with string cs.
TString(const std::string &s)
 Create TString and initialize it with string cs.
TString(const char* s, Ssiz_t n)
 Create TString and initialize it with the first n characters of cs.
void InitChar(char c)
 Initialize a string with a single character.
TString(char c)
 Initialize a string with a single character.
TString(char c, Ssiz_t s)
 Initialize the first n locations of a TString with character c.
TString(const TString& s)
 Copy constructor.
TString(TString&& s)
 Move constructor.
TString(const TSubString& sub)
TString(const char* a1, Ssiz_t n1, const char* a2, Ssiz_t n2)
 Special constructor to initialize with the concatenation of a1 and a2.
~TString()
 Delete a TString.
char * Init(Ssiz_t capacity, Ssiz_t nchar)
 Private member function returning an empty string representation of
 size capacity and containing nchar characters.
TString& operator=(char s)
 Assign character c to TString.
TString& operator=(const char* s)
 Assign string cs to TString.
TString& operator=(const std::string &s)
 Assign std::string s to TString.
TString& operator=(const TString& s)
 Assignment operator.
TString& operator=(const TSubString& s)
 Assign a TSubString substr to TString.
TString& Append(char c, Ssiz_t rep = 1)
 Append character c rep times to string.
Ssiz_t Capacity(Ssiz_t n)
 Return string capacity. If nc != current capacity Clone() the string
 in a string with the desired capacity.
int CompareTo(const char* cs, TString::ECaseCompare cmp = kExact) const
 Compare a string to char *cs2. Returns returns zero if the two
 strings are identical, otherwise returns the difference between
 the first two differing bytes (treated as unsigned char values,
 so that `\200' is greater than `\0', for example). Zero-length
 strings are always identical.
int CompareTo(const TString& st, TString::ECaseCompare cmp = kExact) const
 Compare a string to another string. Returns returns zero if the two
 strings are identical, otherwise returns the difference between
 the first two differing bytes (treated as unsigned char values,
 so that `\200' is greater than `\0', for example). Zero-length
 strings are always identical.
Int_t CountChar(Int_t c) const
 Return number of times character c occurs in the string.
TString Copy() const
 Copy a string.
Ssiz_t First(char c) const
 Find first occurrence of a character c.
Ssiz_t First(const char* cs) const
 Find first occurrence of a character in cs.
UInt_t HashCase() const
 Return a case-sensitive hash value (endian independent).
UInt_t HashFoldCase() const
 Return a case-insensitive hash value (endian independent).
UInt_t Hash(TString::ECaseCompare cmp = kExact) const
 Return hash value.
UInt_t Hash(const void* txt, Int_t ntxt)
 Calculates hash index from any char string. (static function)
 For string:  i = TString::Hash(string,nstring);
 For int:     i = TString::Hash(&intword,sizeof(int));
 For pointer: i = TString::Hash(&pointer,sizeof(void*));

 This employs two different hash functions, depending on ntxt:
   ntxt == sizeof(void*): a simple bitwise xor to get fast pointer hashes
   else: MurmurHash3_x64_128 http://code.google.com/p/smhasher
Ssiz_t Index(const char* pat, Ssiz_t patlen, Ssiz_t i, TString::ECaseCompare cmp) const
 Search for a string in the TString. Plen is the length of pattern,
 startIndex is the index from which to start and cmp selects the type
 of case-comparison.
Ssiz_t Last(char c) const
 Find last occurrence of a character c.
TString MD5() const
 Return the MD5 digest for this string, in a string representation.
Bool_t MaybeRegexp() const
 Returns true if string contains one of the regexp characters "^$.[]*+?".
Bool_t MaybeWildcard() const
 Returns true if string contains one of the wildcard characters "[]*?".
TString& Prepend(char c, Ssiz_t rep = 1)
 Prepend character c rep times to string.
TString & Replace(Ssiz_t pos, Ssiz_t n, const char* s, Ssiz_t ns)
 Remove at most n1 characters from self beginning at pos,
 and replace them with the first n2 characters of cs.
TString& ReplaceAll(const char* s1, Ssiz_t ls1, const char* s2, Ssiz_t ls2)
 Find & Replace ls1 symbols of s1 with ls2 symbols of s2 if any.
TString & Remove(TString::EStripType s, char c)
 Remove char c at begin and/or end of string (like Strip()) but
 modifies directly the string.
void Resize(Ssiz_t n)
 Resize the string. Truncate or add blanks as necessary.
TSubString Strip(TString::EStripType s = kTrailing, char c = ' ') const
 Return a substring of self stripped at beginning and/or end.
void ToLower()
 Change string to lower-case.
void ToUpper()
 Change string to upper case.
void AssertElement(Ssiz_t nc) const
 Check to make sure a string index is in range.
Ssiz_t AdjustCapacity(Ssiz_t oldCap, Ssiz_t newCap)
 Calculate a nice capacity greater than or equal to newCap.
void Clear()
 Clear string without changing its capacity.
void Clobber(Ssiz_t nc)
 Clear string and make sure it has a capacity of nc.
void Clone(Ssiz_t nc)
 Make self a distinct copy with capacity of at least tot, where tot cannot
 be smaller than the current length. Preserve previous contents.
void FillBuffer(char*& buffer) const
 Copy string into I/O buffer.
void ReadBuffer(char*& buffer)
 Read string from I/O buffer.
TString * ReadString(TBuffer& b, const TClass* clReq)
 Read TString object from buffer. Simplified version of
 TBuffer::ReadObject (does not keep track of multiple
 references to same string).  We need to have it here
 because TBuffer::ReadObject can only handle descendant
 of TObject.
Int_t Sizeof() const
 Returns size string will occupy on I/O buffer.
void Streamer(TBuffer& )
 Stream a string object.
void WriteString(TBuffer& b, const TString* a)
 Write TString object to buffer. Simplified version of
 TBuffer::WriteObject (does not keep track of multiple
 references to the same string).  We need to have it here
 because TBuffer::ReadObject can only handle descendant
 of TObject
Ssiz_t GetInitialCapacity()
Ssiz_t GetResizeIncrement()
Ssiz_t GetMaxWaste()
Ssiz_t InitialCapacity(Ssiz_t ic = 15)
 Set default initial capacity for all TStrings. Default is 15.
Ssiz_t ResizeIncrement(Ssiz_t ri = 16)
 Set default resize increment for all TStrings. Default is 16.
Ssiz_t MaxWaste(Ssiz_t mw = 15)
 Set maximum space that may be wasted in a string before doing a resize.
 Default is 15.
TSubString operator()(Ssiz_t start, Ssiz_t len) const
 Return sub-string of string starting at start with length len.
TSubString SubString(const char* pat, Ssiz_t start = 0, TString::ECaseCompare cmp = kExact) const
 Returns a substring matching "pattern", or the null substring
 if there is no such match.  It would be nice if this could be yet another
 overloaded version of operator(), but this would result in a type
 conversion ambiguity with operator(Ssiz_t, Ssiz_t).
Bool_t IsAscii() const
 Returns true if all characters in string are ascii.
Bool_t IsAlpha() const
 Returns true if all characters in string are alphabetic.
 Returns false in case string length is 0.
Bool_t IsAlnum() const
 Returns true if all characters in string are alphanumeric.
 Returns false in case string length is 0.
Bool_t IsDigit() const
 Returns true if all characters in string are digits (0-9) or whitespaces,
 i.e. "123456" and "123 456" are both valid integer strings.
 Returns false in case string length is 0 or string contains other
 characters or only whitespace.
Bool_t IsFloat() const
 Returns kTRUE if string contains a floating point or integer number.
 Examples of valid formats are:
    64320
    64 320
    6 4 3 2 0
    6.4320     6,4320
    6.43e20   6.43E20    6,43e20
    6.43e-20  6.43E-20   6,43e-20, -6.43e+20
Bool_t IsHex() const
 Returns true if all characters in string are hexidecimal digits
 (0-9,a-f,A-F). Returns false in case string length is 0 or string
 contains other characters.
Bool_t IsBin() const
 Returns true if all characters in string are binary digits (0,1).
 Returns false in case string length is 0 or string contains other
 characters.
Bool_t IsOct() const
 Returns true if all characters in string are octal digits (0-7).
 Returns false in case string length is 0 or string contains other
 characters.
Bool_t IsDec() const
 Returns true if all characters in string are decimal digits (0-9).
 Returns false in case string length is 0 or string contains other
 characters.
Bool_t IsInBaseN(Int_t base) const
 Returns true if all characters in string are expressed in the base
 specified (range=2-36), i.e. {0,1} for base 2, {0-9,a-f,A-F} for base 16,
 {0-9,a-z,A-Z} for base 36. Returns false in case string length is 0 or
 string contains other characters.
Int_t Atoi() const
 Return integer value of string.
 Valid strings include only digits and whitespace (see IsDigit()),
 i.e. "123456", "123 456" and "1 2 3 4        56" are all valid
 integer strings whose Atoi() value is 123456.
Long64_t Atoll() const
 Return long long value of string.
 Valid strings include only digits and whitespace (see IsDigit()),
 i.e. "123456", "123 456" and "1 2 3 4        56" are all valid
 integer strings whose Atoll() value is 123456.
Double_t Atof() const
 Return floating-point value contained in string.
 Examples of valid strings are:
    64320
    64 320
    6 4 3 2 0
    6.4320     6,4320
    6.43e20   6.43E20    6,43e20
    6.43e-20  6.43E-20   6,43e-20
TString Itoa(Int_t value, Int_t base)
 Converts an Int_t to a TString with respect to the base specified (2-36).
 Thus it is an enhanced version of sprintf (adapted from versions 0.4 of
 http://www.jb.man.ac.uk/~slowe/cpp/itoa.html).
 Usage: the following statement produce the same output, namely "1111"
   std::cout << TString::Itoa(15,2) ;
   std::cout << TString::Itoa(0xF,2) ; /// 0x prefix to handle hex
   std::cout << TString::Itoa(017,2) ; /// 0  prefix to handle oct
 In case of error returns the "!" string.
TString UItoa(UInt_t value, Int_t base)
 Converts a UInt_t (twice the range of an Int_t) to a TString with respect
 to the base specified (2-36). Thus it is an enhanced version of sprintf
 (adapted from versions 0.4 of http://www.jb.man.ac.uk/~slowe/cpp/itoa.html).
 In case of error returns the "!" string.
TString LLtoa(Long64_t value, Int_t base)
 Converts a Long64_t to a TString with respect to the base specified (2-36).
 Thus it is an enhanced version of sprintf (adapted from versions 0.4 of
 http://www.jb.man.ac.uk/~slowe/cpp/itoa.html).
 In case of error returns the "!" string.
TString ULLtoa(ULong64_t value, Int_t base)
 Converts a ULong64_t (twice the range of an Long64_t) to a TString with
 respect to the base specified (2-36). Thus it is an enhanced version of
 sprintf (adapted from versions 0.4 of http://www.jb.man.ac.uk/~slowe/cpp/itoa.html).
 In case of error returns the "!" string.
TString BaseConvert(const TString& s_in, Int_t base_in, Int_t base_out)
 Converts string from base base_in to base base_out. Supported bases
 are 2-36. At most 64 bit data can be converted.
Bool_t EndsWith(const char* pat, TString::ECaseCompare cmp = kExact) const
 Return true if string ends with the specified string.
TObjArray * Tokenize(const TString& delim) const
 This function is used to isolate sequential tokens in a TString.
 These tokens are separated in the string by at least one of the
 characters in delim. The returned array contains the tokens
 as TObjString's. The returned array is the owner of the objects,
 and must be deleted by the user.
void FormImp(const char* fmt, va_list ap)
 Formats a string using a printf style format descriptor.
 Existing string contents will be overwritten.
void Form(const char *va_(fmt), ...)
 Formats a string using a printf style format descriptor.
 Existing string contents will be overwritten.
TString Format(const char *va_(fmt), ...)
 Static method which formats a string using a printf style format
 descriptor and return a TString. Same as TString::Form() but it is
 not needed to first create a TString.
TString & Append(const char* cs)
{ return Replace(Length(), 0, cs, cs ? strlen(cs) : 0); }
TString & Append(const char* cs, Ssiz_t n)
{ return Replace(Length(), 0, cs, n); }
TString & Append(const TString& s)
{ return Replace(Length(), 0, s.Data(), s.Length()); }
TString & Append(const TString& s, Ssiz_t n)
{ return Replace(Length(), 0, s.Data(), TMath::Min(n, s.Length())); }
TString & operator+=(const char* s)
{ return Append(cs, cs ? strlen(cs) : 0); }
TString & operator+=(const TString& s)
{ return Append(s.Data(), s.Length()); }
TString & operator+=(char c)
{ return Append(c); }
TString & operator+=(Long_t i)
{ char s[32]; sprintf(s, "%ld", i); return operator+=(s); }
TString & operator+=(ULong_t i)
{ char s[32]; sprintf(s, "%lu", i); return operator+=(s); }
TString & operator+=(Short_t i)
{ return operator+=((Long_t) i); }
TString & operator+=(UShort_t i)
{ return operator+=((ULong_t) i); }
TString & operator+=(Int_t i)
{ return operator+=((Long_t) i); }
TString & operator+=(UInt_t i)
{ return operator+=((ULong_t) i); }
TString & operator+=(Double_t f)
TString & operator+=(Float_t f)
{ return operator+=((Double_t) f); }
TString & operator+=(Long64_t i)
TString & operator+=(ULong64_t i)
Bool_t BeginsWith(const char* s, TString::ECaseCompare cmp = kExact) const
{ return Index(s, s ? strlen(s) : (Ssiz_t)0, (Ssiz_t)0, cmp) == 0; }
Bool_t BeginsWith(const TString& pat, TString::ECaseCompare cmp = kExact) const
{ return Index(pat.Data(), pat.Length(), (Ssiz_t)0, cmp) == 0; }
Bool_t Contains(const TString& pat, TString::ECaseCompare cmp = kExact) const
{ return Index(pat.Data(), pat.Length(), (Ssiz_t)0, cmp) != kNPOS; }
Bool_t Contains(const char* pat, TString::ECaseCompare cmp = kExact) const
{ return Index(s, s ? strlen(s) : 0, (Ssiz_t)0, cmp) != kNPOS; }
Bool_t Contains(const TRegexp& pat) const
{ return Index(pat, (Ssiz_t)0) != kNPOS; }
Bool_t Contains(TPRegexp& pat) const
{ return Index(pat, (Ssiz_t)0) != kNPOS; }
Bool_t EqualTo(const char* cs, TString::ECaseCompare cmp = kExact) const
{ return (CompareTo(cs, cmp) == 0) ? kTRUE : kFALSE; }
Bool_t EqualTo(const TString& st, TString::ECaseCompare cmp = kExact) const
{ return (CompareTo(st, cmp) == 0) ? kTRUE : kFALSE; }
Ssiz_t Index(const char* pat, Ssiz_t i = 0, TString::ECaseCompare cmp = kExact) const
{ return Index(s, s ? strlen(s) : 0, i, cmp); }
Ssiz_t Index(const TString& s, Ssiz_t i = 0, TString::ECaseCompare cmp = kExact) const
{ return Index(s.Data(), s.Length(), i, cmp); }
Ssiz_t Index(const TString& s, Ssiz_t patlen, Ssiz_t i, TString::ECaseCompare cmp) const
{ return Index(pat.Data(), patlen, i, cmp); }
TString & Insert(Ssiz_t pos, const char* s)
{ return Replace(pos, 0, cs, cs ? strlen(cs) : 0); }
TString & Insert(Ssiz_t pos, const char* s, Ssiz_t extent)
{ return Replace(pos, 0, cs, n); }
TString & Insert(Ssiz_t pos, const TString& s)
{ return Replace(pos, 0, s.Data(), s.Length()); }
TString & Insert(Ssiz_t pos, const TString& s, Ssiz_t extent)
{ return Replace(pos, 0, s.Data(), TMath::Min(n, s.Length())); }
TString & Prepend(const char* cs)
{ return Replace(0, 0, cs, cs ? strlen(cs) : 0); }
TString & Prepend(const char* cs, Ssiz_t n)
{ return Replace(0, 0, cs, n); }
TString & Prepend(const TString& s)
{ return Replace(0, 0, s.Data(), s.Length()); }
TString & Prepend(const TString& s, Ssiz_t n)
{ return Replace(0, 0, s.Data(), TMath::Min(n, s.Length())); }
TString & Remove(Ssiz_t pos)
{ return Replace(pos, TMath::Max(0, Length()-pos), 0, 0); }
TString & Remove(Ssiz_t pos, Ssiz_t n)
{ return Replace(pos, n, 0, 0); }
TString & Chop()
{ return Remove(TMath::Max(0, Length()-1)); }
TString & Replace(Ssiz_t pos, Ssiz_t n, const char* s)
{ return Replace(pos, n, cs, cs ? strlen(cs) : 0); }
TString & Replace(Ssiz_t pos, Ssiz_t n, const TString& s)
{ return Replace(pos, n, s.Data(), s.Length()); }
TString & Replace(Ssiz_t pos, Ssiz_t n1, const TString& s, Ssiz_t n2)
{ return Replace(pos, n1, s.Data(), TMath::Min(s.Length(), n2)); }
TString & ReplaceAll(const TString& s1, const TString& s2)
{ return ReplaceAll(s1.Data(), s1.Length(), s2.Data(), s2.Length()) ; }
TString & ReplaceAll(const TString& s1, const char* s2)
{ return ReplaceAll(s1.Data(), s1.Length(), s2, s2 ? strlen(s2) : 0); }
TString & ReplaceAll(const char* s1, const TString& s2)
{ return ReplaceAll(s1, s1 ? strlen(s1) : 0, s2.Data(), s2.Length()); }
TString & ReplaceAll(const char* s1, const char* s2)
{ return ReplaceAll(s1, s1 ? strlen(s1) : 0, s2, s2 ? strlen(s2) : 0); }
TString & Swap(TString& other)
 Swap the contents of other and this without reallocation.
char & operator()(Ssiz_t i)
{ return GetPointer()[i]; }
char operator()(Ssiz_t i) const
{ return GetPointer()[i]; }
char & operator[](Ssiz_t i)
{ AssertElement(i); return GetPointer()[i]; }
char operator[](Ssiz_t i) const
{ AssertElement(i); return GetPointer()[i]; }
TSubString & operator=(const char* s)
char & operator()(Ssiz_t i)
char operator()(Ssiz_t i) const
const char * Data() const
Ssiz_t Length() const
{ return fExtent; }
Bool_t IsNull() const
 For detecting null substrings
{ return fBegin == kNPOS; }
TString(const char* a1, Ssiz_t n1, const char* a2, Ssiz_t n2)
 Special concatenation constructor
Ssiz_t Align(Ssiz_t s)
{ return (s + (kAlignment-1)) & ~(kAlignment-1); }
Ssiz_t Recommend(Ssiz_t s)
{ return (s < kMinCap ? kMinCap : Align(s+1)) - 1; }
Bool_t IsLong() const
{ return Bool_t(fRep.fShort.fSize & kShortMask); }
void SetShortSize(Ssiz_t s)
{ fRep.fShort.fSize = (unsigned char)(s << 1); }
Ssiz_t GetShortSize() const
{ return fRep.fShort.fSize >> 1; }
void SetLongSize(Ssiz_t s)
{ fRep.fLong.fSize = s; }
Ssiz_t GetLongSize() const
{ return fRep.fLong.fSize; }
void SetSize(Ssiz_t s)
void SetLongCap(Ssiz_t s)
{ fRep.fLong.fCap = kLongMask | s; }
Ssiz_t GetLongCap() const
{ return fRep.fLong.fCap & ~kLongMask; }
void SetLongPointer(char* p)
{ fRep.fLong.fData = p; }
char * GetLongPointer()
{ return fRep.fLong.fData; }
const char * GetLongPointer() const
{ return fRep.fLong.fData; }
char * GetShortPointer()
{ return fRep.fShort.fData; }
const char * GetShortPointer() const
{ return fRep.fShort.fData; }
char * GetPointer()
{ return IsLong() ? GetLongPointer() : GetShortPointer(); }
const char * GetPointer() const
{ return IsLong() ? GetLongPointer() : GetShortPointer(); }
Ssiz_t MaxSize()
{ return kMaxInt - 1; }
void UnLink() const
{ if (IsLong()) delete [] fRep.fLong.fData; }
void Zero()
TString * ReadString(TBuffer& b, const TClass* clReq)
Bool_t Gets(FILE* fp, Bool_t chop = kTRUE)
 C I/O interface
void Puts(FILE* fp)
char & operator()(Ssiz_t i)
char operator()(Ssiz_t i) const
Ssiz_t Capacity() const
{ return (IsLong() ? GetLongCap() : kMinCap) - 1; }
Ssiz_t Index(const char* pat, Ssiz_t i = 0, TString::ECaseCompare cmp = kExact) const
Ssiz_t Index(const char* pat, Ssiz_t patlen, Ssiz_t i, TString::ECaseCompare cmp) const
Ssiz_t Index(const TRegexp& pat, Ssiz_t i = 0) const
Ssiz_t Index(const TRegexp& pat, Ssiz_t* ext, Ssiz_t i = 0) const
Bool_t IsWhitespace() const
{ return (Length() == CountChar(' ')); }
std::istream & ReadFile(istream& str)
std::istream & ReadLine(istream& str, Bool_t skipWhite = kTRUE)
std::istream & ReadToDelim(istream& str, char delim = '\n')
std::istream & ReadToken(istream& str)
TObjArray * Tokenize(const TString& delim) const