Logo ROOT   6.08/07
Reference Guide
List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Static Private Member Functions | Friends | List of all members
TString Class Reference

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"

Definition at line 137 of file TString.h.

Classes

struct  LongStr_t
 
struct  RawStr_t
 
struct  Rep_t
 
struct  ShortStr_t
 
union  UStr_t
 

Public Types

enum  ECaseCompare { kExact, kIgnoreCase }
 
enum  EStripType { kLeading = 0x1, kTrailing = 0x2, kBoth = 0x3 }
 

Public Member Functions

 TString ()
 TString default ctor. More...
 
 TString (Ssiz_t ic)
 Create TString able to contain ic characters. More...
 
 TString (const TString &s)
 Copy constructor. More...
 
 TString (TString &&s)
 Move constructor. More...
 
 TString (const char *s)
 Create TString and initialize it with string cs. More...
 
 TString (const char *s, Ssiz_t n)
 Create TString and initialize it with the first n characters of cs. More...
 
 TString (const std::string &s)
 Create TString and initialize it with string cs. More...
 
 TString (char c)
 Initialize a string with a single character. More...
 
 TString (char c, Ssiz_t s)
 Initialize the first n locations of a TString with character c. More...
 
 TString (const std::string_view &sub)
 
 TString (const TSubString &sub)
 Copy a TSubString in a TString. More...
 
virtual ~TString ()
 Delete a TString. More...
 
TStringAppend (const char *cs)
 
TStringAppend (const char *cs, Ssiz_t n)
 
TStringAppend (const TString &s)
 
TStringAppend (const TString &s, Ssiz_t n)
 
TStringAppend (char c, Ssiz_t rep=1)
 Append character c rep times to string. More...
 
Double_t Atof () const
 Return floating-point value contained in string. More...
 
Int_t Atoi () const
 Return integer value of string. More...
 
Long64_t Atoll () const
 Return long long value of string. More...
 
Bool_t BeginsWith (const char *s, ECaseCompare cmp=kExact) const
 
Bool_t BeginsWith (const TString &pat, ECaseCompare cmp=kExact) const
 
Ssiz_t Capacity () const
 
Ssiz_t Capacity (Ssiz_t n)
 Return string capacity. More...
 
TStringChop ()
 
void Clear ()
 Clear string without changing its capacity. More...
 
int CompareTo (const char *cs, ECaseCompare cmp=kExact) const
 Compare a string to char *cs2. More...
 
int CompareTo (const TString &st, ECaseCompare cmp=kExact) const
 Compare a string to another string. More...
 
Bool_t Contains (const char *pat, ECaseCompare cmp=kExact) const
 
Bool_t Contains (const TString &pat, ECaseCompare cmp=kExact) const
 
Bool_t Contains (const TRegexp &pat) const
 
Bool_t Contains (TPRegexp &pat) const
 
TString Copy () const
 Copy a string. More...
 
Int_t CountChar (Int_t c) const
 Return number of times character c occurs in the string. More...
 
const char * Data () const
 
Bool_t EndsWith (const char *pat, ECaseCompare cmp=kExact) const
 Return true if string ends with the specified string. More...
 
Bool_t EqualTo (const char *cs, ECaseCompare cmp=kExact) const
 
Bool_t EqualTo (const TString &st, ECaseCompare cmp=kExact) const
 
virtual void FillBuffer (char *&buffer) const
 Copy string into I/O buffer. More...
 
Ssiz_t First (char c) const
 Find first occurrence of a character c. More...
 
Ssiz_t First (const char *cs) const
 Find first occurrence of a character in cs. More...
 
void Form (const char *fmt,...)
 Formats a string using a printf style format descriptor. More...
 
Bool_t Gets (FILE *fp, Bool_t chop=kTRUE)
 Read one line from the stream, including the
, or until EOF. More...
 
UInt_t Hash (ECaseCompare cmp=kExact) const
 Return hash value. More...
 
Ssiz_t Index (const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
 
Ssiz_t Index (const TString &s, Ssiz_t i=0, ECaseCompare cmp=kExact) const
 
Ssiz_t Index (const char *pat, Ssiz_t patlen, Ssiz_t i, ECaseCompare cmp) const
 Search for a string in the TString. More...
 
Ssiz_t Index (const TString &s, Ssiz_t patlen, Ssiz_t i, ECaseCompare cmp) const
 
Ssiz_t Index (const TRegexp &pat, Ssiz_t i=0) const
 Find the first occurrence of the regexp in string and return the position, or -1 if there is no match. More...
 
Ssiz_t Index (const TRegexp &pat, Ssiz_t *ext, Ssiz_t i=0) const
 Find the first occurrence of the regexp in string and return the position, or -1 if there is no match. More...
 
Ssiz_t Index (TPRegexp &pat, Ssiz_t i=0) const
 Find the first occurrence of the regexp in string and return the position. More...
 
Ssiz_t Index (TPRegexp &pat, Ssiz_t *ext, Ssiz_t i=0) const
 Find the first occurrence of the regexp in string and return the position. More...
 
TStringInsert (Ssiz_t pos, const char *s)
 
TStringInsert (Ssiz_t pos, const char *s, Ssiz_t extent)
 
TStringInsert (Ssiz_t pos, const TString &s)
 
TStringInsert (Ssiz_t pos, const TString &s, Ssiz_t extent)
 
Bool_t IsAlnum () const
 Returns true if all characters in string are alphanumeric. More...
 
Bool_t IsAlpha () const
 Returns true if all characters in string are alphabetic. More...
 
Bool_t IsAscii () const
 Returns true if all characters in string are ascii. More...
 
Bool_t IsBin () const
 Returns true if all characters in string are binary digits (0,1). More...
 
Bool_t IsDec () const
 Returns true if all characters in string are decimal digits (0-9). More...
 
Bool_t IsDigit () const
 Returns true if all characters in string are digits (0-9) or white spaces, i.e. More...
 
Bool_t IsFloat () const
 Returns kTRUE if string contains a floating point or integer number. More...
 
Bool_t IsHex () const
 Returns true if all characters in string are hexadecimal digits (0-9,a-f,A-F). More...
 
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. More...
 
Bool_t IsNull () const
 
Bool_t IsOct () const
 Returns true if all characters in string are octal digits (0-7). More...
 
Bool_t IsWhitespace () const
 
Ssiz_t Last (char c) const
 Find last occurrence of a character c. More...
 
Ssiz_t Length () const
 
Bool_t MaybeRegexp () const
 Returns true if string contains one of the regexp characters "^$.[]*+?". More...
 
Bool_t MaybeWildcard () const
 Returns true if string contains one of the wildcard characters "[]*?". More...
 
TString MD5 () const
 Return the MD5 digest for this string, in a string representation. More...
 
 operator const char * () const
 
 operator std::string_view () const
 
char & operator() (Ssiz_t i)
 
char operator() (Ssiz_t i) const
 
TSubString operator() (Ssiz_t start, Ssiz_t len) const
 Return sub-string of string starting at start with length len. More...
 
TSubString operator() (const TRegexp &re) const
 Return the substring found by applying the regexp. More...
 
TSubString operator() (const TRegexp &re, Ssiz_t start) const
 Return the substring found by applying the regexp starting at start. More...
 
TSubString operator() (TPRegexp &re) const
 Return the substring found by applying the regexp. More...
 
TSubString operator() (TPRegexp &re, Ssiz_t start) const
 Return the substring found by applying the regexp starting at start. More...
 
TStringoperator+= (const char *s)
 
TStringoperator+= (const TString &s)
 
TStringoperator+= (char c)
 
TStringoperator+= (Short_t i)
 
TStringoperator+= (UShort_t i)
 
TStringoperator+= (Int_t i)
 
TStringoperator+= (UInt_t i)
 
TStringoperator+= (Long_t i)
 
TStringoperator+= (ULong_t i)
 
TStringoperator+= (Float_t f)
 
TStringoperator+= (Double_t f)
 
TStringoperator+= (Long64_t i)
 
TStringoperator+= (ULong64_t i)
 
TStringoperator= (char s)
 Assign character c to TString. More...
 
TStringoperator= (const char *s)
 Assign string cs to TString. More...
 
TStringoperator= (const TString &s)
 Assignment operator. More...
 
TStringoperator= (const std::string &s)
 Assign std::string s to TString. More...
 
TStringoperator= (const std::string_view &s)
 Assign std::string s to TString. More...
 
TStringoperator= (const TSubString &s)
 Assign a TSubString substr to TString. More...
 
char & operator[] (Ssiz_t i)
 
char operator[] (Ssiz_t i) const
 
TStringPrepend (const char *cs)
 
TStringPrepend (const char *cs, Ssiz_t n)
 
TStringPrepend (const TString &s)
 
TStringPrepend (const TString &s, Ssiz_t n)
 
TStringPrepend (char c, Ssiz_t rep=1)
 Prepend character c rep times to string. More...
 
void Puts (FILE *fp)
 Write string to the stream. More...
 
virtual void ReadBuffer (char *&buffer)
 Read string from I/O buffer. More...
 
std::istream & ReadFile (std::istream &str)
 Replace string with the contents of strm, stopping at an EOF. More...
 
std::istream & ReadLine (std::istream &str, Bool_t skipWhite=kTRUE)
 Read a line from stream upto newline skipping any whitespace. More...
 
std::istream & ReadString (std::istream &str)
 Read a line from stream upto \0, including any newline. More...
 
std::istream & ReadToDelim (std::istream &str, char delim='\n')
 Read up to an EOF, or a delimiting character, whichever comes first. More...
 
std::istream & ReadToken (std::istream &str)
 Read a token, delimited by whitespace, from the input stream. More...
 
TStringRemove (Ssiz_t pos)
 
TStringRemove (Ssiz_t pos, Ssiz_t n)
 
TStringRemove (EStripType s, char c)
 Remove char c at begin and/or end of string (like Strip()) but modifies directly the string. More...
 
TStringReplace (Ssiz_t pos, Ssiz_t n, const char *s)
 
TStringReplace (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. More...
 
TStringReplace (Ssiz_t pos, Ssiz_t n, const TString &s)
 
TStringReplace (Ssiz_t pos, Ssiz_t n1, const TString &s, Ssiz_t n2)
 
TStringReplaceAll (const TString &s1, const TString &s2)
 
TStringReplaceAll (const TString &s1, const char *s2)
 
TStringReplaceAll (const char *s1, const TString &s2)
 
TStringReplaceAll (const char *s1, const char *s2)
 
TStringReplaceAll (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. More...
 
void Resize (Ssiz_t n)
 Resize the string. Truncate or add blanks as necessary. More...
 
virtual Int_t Sizeof () const
 Returns size string will occupy on I/O buffer. More...
 
TSubString Strip (EStripType s=kTrailing, char c=' ') const
 Return a substring of self stripped at beginning and/or end. More...
 
TSubString SubString (const char *pat, Ssiz_t start=0, ECaseCompare cmp=kExact) const
 Returns a substring matching "pattern", or the null substring if there is no such match. More...
 
TStringSwap (TString &other)
 
TObjArrayTokenize (const TString &delim) const
 This function is used to isolate sequential tokens in a TString. More...
 
Bool_t Tokenize (TString &tok, Ssiz_t &from, const char *delim=" ") const
 Search for tokens delimited by regular expression 'delim' (default " ") in this string; search starts at 'from' and the token is returned in 'tok'. More...
 
void ToLower ()
 Change string to lower-case. More...
 
void ToUpper ()
 Change string to upper case. More...
 

Static Public Member Functions

static TString BaseConvert (const TString &s_in, Int_t base_in, Int_t base_out)
 Converts string from base base_in to base base_out. More...
 
static TString Format (const char *fmt,...)
 Static method which formats a string using a printf style format descriptor and return a TString. More...
 
static Ssiz_t GetInitialCapacity ()
 
static Ssiz_t GetMaxWaste ()
 
static Ssiz_t GetResizeIncrement ()
 
static UInt_t Hash (const void *txt, Int_t ntxt)
 Calculates hash index from any char string. More...
 
static Ssiz_t InitialCapacity (Ssiz_t ic=15)
 Set default initial capacity for all TStrings. Default is 15. More...
 
static TString Itoa (Int_t value, Int_t base)
 Converts an Int_t to a TString with respect to the base specified (2-36). More...
 
static TString LLtoa (Long64_t value, Int_t base)
 Converts a Long64_t to a TString with respect to the base specified (2-36). More...
 
static Ssiz_t MaxWaste (Ssiz_t mw=15)
 Set maximum space that may be wasted in a string before doing a resize. More...
 
static TStringReadString (TBuffer &b, const TClass *clReq)
 Read TString object from buffer. More...
 
static Ssiz_t ResizeIncrement (Ssiz_t ri=16)
 Set default resize increment for all TStrings. Default is 16. More...
 
static 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). More...
 
static 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). More...
 
static void WriteString (TBuffer &b, const TString *a)
 Write TString object to buffer. More...
 

Static Public Attributes

static const Ssiz_t kNPOS = ::kNPOS
 

Protected Types

enum  { kAlignment = 16 }
 

Protected Member Functions

 TString (const char *a1, Ssiz_t n1, const char *a2, Ssiz_t n2)
 String data. More...
 
void AssertElement (Ssiz_t nc) const
 Check to make sure a string index is in range. More...
 
void Clobber (Ssiz_t nc)
 Clear string and make sure it has a capacity of nc. More...
 
void InitChar (char c)
 Initialize a string with a single character. More...
 

Static Protected Member Functions

static Ssiz_t AdjustCapacity (Ssiz_t oldCap, Ssiz_t newCap)
 Calculate a nice capacity greater than or equal to newCap. More...
 
static Ssiz_t Align (Ssiz_t s)
 
static Ssiz_t Recommend (Ssiz_t s)
 

Protected Attributes

Rep_t fRep
 

Private Types

enum  
 
enum  { kNwords = sizeof(UStr_t) / sizeof(Ssiz_t) }
 
enum  { kShortMask = 0x80, kLongMask = 0x80000000 }
 

Private Member Functions

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. More...
 
void FormImp (const char *fmt, va_list ap)
 Formats a string using a printf style format descriptor. More...
 
Ssiz_t GetLongCap () const
 
char * GetLongPointer ()
 
const char * GetLongPointer () const
 
Ssiz_t GetLongSize () const
 
char * GetPointer ()
 
const char * GetPointer () const
 
char * GetShortPointer ()
 
const char * GetShortPointer () const
 
Ssiz_t GetShortSize () const
 
UInt_t HashCase () const
 Return a case-sensitive hash value (endian independent). More...
 
UInt_t HashFoldCase () const
 Return a case-insensitive hash value (endian independent). More...
 
char * Init (Ssiz_t capacity, Ssiz_t nchar)
 Private member function returning an empty string representation of size capacity and containing nchar characters. More...
 
Bool_t IsLong () const
 
void SetLongCap (Ssiz_t s)
 
void SetLongPointer (char *p)
 
void SetLongSize (Ssiz_t s)
 
void SetShortSize (Ssiz_t s)
 
void SetSize (Ssiz_t s)
 
void UnLink () const
 
void Zero ()
 

Static Private Member Functions

static Ssiz_t MaxSize ()
 

Friends

TString operator+ (const TString &s1, const TString &s2)
 Use the special concatenation constructor. More...
 
TString operator+ (const TString &s, const char *cs)
 Use the special concatenation constructor. More...
 
TString operator+ (const char *cs, const TString &s)
 Use the special concatenation constructor. More...
 
TString operator+ (const TString &s, char c)
 Add char to string. More...
 
TString operator+ (const TString &s, Long_t i)
 Add integer to string. More...
 
TString operator+ (const TString &s, ULong_t i)
 Add integer to string. More...
 
TString operator+ (const TString &s, Long64_t i)
 Add integer to string. More...
 
TString operator+ (const TString &s, ULong64_t i)
 Add integer to string. More...
 
TString operator+ (char c, const TString &s)
 Add string to integer. More...
 
TString operator+ (Long_t i, const TString &s)
 Add string to integer. More...
 
TString operator+ (ULong_t i, const TString &s)
 Add string to integer. More...
 
TString operator+ (Long64_t i, const TString &s)
 Add string to integer. More...
 
TString operator+ (ULong64_t i, const TString &s)
 Add string to integer. More...
 
TBufferoperator<< (TBuffer &b, const TString *obj)
 Write TString or derived to TBuffer. More...
 
Bool_t operator== (const TString &s1, const TString &s2)
 
Bool_t operator== (const TString &s1, const char *s2)
 Compare TString with a char *. More...
 
class TBufferFile
 
class TStringLong
 
class TSubString
 

#include <TString.h>

Inheritance diagram for TString:
[legend]

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

Definition at line 173 of file TString.h.

◆ anonymous enum

anonymous enum
private
Enumerator
kNwords 

Definition at line 184 of file TString.h.

◆ anonymous enum

anonymous enum
protected
Enumerator
kAlignment 

Definition at line 212 of file TString.h.

◆ anonymous enum

anonymous enum
private
Enumerator
kShortMask 
kLongMask 

Definition at line 163 of file TString.h.

◆ ECaseCompare

Enumerator
kExact 
kIgnoreCase 

Definition at line 257 of file TString.h.

◆ EStripType

Enumerator
kLeading 
kTrailing 
kBoth 

Definition at line 256 of file TString.h.

Constructor & Destructor Documentation

◆ TString() [1/12]

TString::TString ( const char *  a1,
Ssiz_t  n1,
const char *  a2,
Ssiz_t  n2 
)
protected

String data.

Special constructor to initialize with the concatenation of a1 and a2.

Definition at line 196 of file TString.cxx.

◆ TString() [2/12]

TString::TString ( )

TString default ctor.

Definition at line 88 of file TString.cxx.

◆ TString() [3/12]

TString::TString ( Ssiz_t  ic)
explicit

Create TString able to contain ic characters.

Definition at line 96 of file TString.cxx.

◆ TString() [4/12]

TString::TString ( const TString s)

Copy constructor.

Definition at line 162 of file TString.cxx.

◆ TString() [5/12]

TString::TString ( TString &&  s)

Move constructor.

Definition at line 176 of file TString.cxx.

◆ TString() [6/12]

TString::TString ( const char *  s)

Create TString and initialize it with string cs.

Definition at line 104 of file TString.cxx.

◆ TString() [7/12]

TString::TString ( const char *  s,
Ssiz_t  n 
)

Create TString and initialize it with the first n characters of cs.

Definition at line 127 of file TString.cxx.

◆ TString() [8/12]

TString::TString ( const std::string &  s)

Create TString and initialize it with string cs.

Definition at line 117 of file TString.cxx.

◆ TString() [9/12]

TString::TString ( char  c)

Initialize a string with a single character.

Definition at line 145 of file TString.cxx.

◆ TString() [10/12]

TString::TString ( char  c,
Ssiz_t  s 
)

Initialize the first n locations of a TString with character c.

Definition at line 153 of file TString.cxx.

◆ TString() [11/12]

TString::TString ( const std::string_view sub)

◆ TString() [12/12]

TString::TString ( const TSubString sub)

Copy a TSubString in a TString.

Definition at line 186 of file TString.cxx.

◆ ~TString()

TString::~TString ( )
virtual

Delete a TString.

Definition at line 209 of file TString.cxx.

Member Function Documentation

◆ AdjustCapacity()

Ssiz_t TString::AdjustCapacity ( Ssiz_t  oldCap,
Ssiz_t  newCap 
)
staticprotected

Calculate a nice capacity greater than or equal to newCap.

Definition at line 1125 of file TString.cxx.

◆ Align()

static Ssiz_t TString::Align ( Ssiz_t  s)
inlinestaticprotected

Definition at line 213 of file TString.h.

◆ Append() [1/5]

TString & TString::Append ( const char *  cs)
inline

Definition at line 492 of file TString.h.

◆ Append() [2/5]

TString & TString::Append ( const char *  cs,
Ssiz_t  n 
)
inline

Definition at line 495 of file TString.h.

◆ Append() [3/5]

TString & TString::Append ( const TString s)
inline

Definition at line 498 of file TString.h.

◆ Append() [4/5]

TString & TString::Append ( const TString s,
Ssiz_t  n 
)
inline

Definition at line 501 of file TString.h.

◆ Append() [5/5]

TString & TString::Append ( char  c,
Ssiz_t  rep = 1 
)

Append character c rep times to string.

Definition at line 330 of file TString.cxx.

◆ AssertElement()

void TString::AssertElement ( Ssiz_t  nc) const
protected

Check to make sure a string index is in range.

Definition at line 1115 of file TString.cxx.

◆ Atof()

Double_t TString::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

Definition at line 2031 of file TString.cxx.

◆ Atoi()

Int_t TString::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.

Definition at line 1965 of file TString.cxx.

◆ Atoll()

Long64_t TString::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.

Definition at line 1991 of file TString.cxx.

◆ BaseConvert()

TString TString::BaseConvert ( const TString s_in,
Int_t  base_in,
Int_t  base_out 
)
static

Converts string from base base_in to base base_out.

Supported bases are 2-36. At most 64 bit data can be converted.

Definition at line 2171 of file TString.cxx.

◆ BeginsWith() [1/2]

Bool_t TString::BeginsWith ( const char *  s,
ECaseCompare  cmp = kExact 
) const
inline

Definition at line 558 of file TString.h.

◆ BeginsWith() [2/2]

Bool_t TString::BeginsWith ( const TString pat,
ECaseCompare  cmp = kExact 
) const
inline

Definition at line 561 of file TString.h.

◆ Capacity() [1/2]

Ssiz_t TString::Capacity ( ) const
inline

Definition at line 337 of file TString.h.

◆ Capacity() [2/2]

Ssiz_t TString::Capacity ( Ssiz_t  nc)

Return string capacity.

If nc != current capacity Clone() the string in a string with the desired capacity.

Definition at line 371 of file TString.cxx.

◆ Chop()

TString & TString::Chop ( )
inline

Definition at line 622 of file TString.h.

◆ Clear()

void TString::Clear ( )

Clear string without changing its capacity.

Definition at line 1140 of file TString.cxx.

◆ Clobber()

void TString::Clobber ( Ssiz_t  nc)
protected

Clear string and make sure it has a capacity of nc.

Definition at line 1148 of file TString.cxx.

◆ Clone()

void TString::Clone ( Ssiz_t  tot)
private

Make self a distinct copy with capacity of at least tot, where tot cannot be smaller than the current length.

Preserve previous contents.

Definition at line 1176 of file TString.cxx.

◆ CompareTo() [1/2]

int TString::CompareTo ( const char *  cs2,
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.

Definition at line 386 of file TString.cxx.

◆ CompareTo() [2/2]

int TString::CompareTo ( const TString str,
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.

Definition at line 416 of file TString.cxx.

◆ Contains() [1/4]

Bool_t TString::Contains ( const char *  pat,
ECaseCompare  cmp = kExact 
) const
inline

Definition at line 567 of file TString.h.

◆ Contains() [2/4]

Bool_t TString::Contains ( const TString pat,
ECaseCompare  cmp = kExact 
) const
inline

Definition at line 564 of file TString.h.

◆ Contains() [3/4]

Bool_t TString::Contains ( const TRegexp pat) const
inline

Definition at line 570 of file TString.h.

◆ Contains() [4/4]

Bool_t TString::Contains ( TPRegexp pat) const
inline

Definition at line 573 of file TString.h.

◆ Copy()

TString TString::Copy ( ) const

Copy a string.

Definition at line 458 of file TString.cxx.

◆ CountChar()

Int_t TString::CountChar ( Int_t  c) const

Return number of times character c occurs in the string.

Definition at line 444 of file TString.cxx.

◆ Data()

const char* TString::Data ( ) const
inline

Definition at line 349 of file TString.h.

◆ EndsWith()

Bool_t TString::EndsWith ( const char *  pat,
ECaseCompare  cmp = kExact 
) const

Return true if string ends with the specified string.

Definition at line 2221 of file TString.cxx.

◆ EqualTo() [1/2]

Bool_t TString::EqualTo ( const char *  cs,
ECaseCompare  cmp = kExact 
) const
inline

Definition at line 576 of file TString.h.

◆ EqualTo() [2/2]

Bool_t TString::EqualTo ( const TString st,
ECaseCompare  cmp = kExact 
) const
inline

Definition at line 579 of file TString.h.

◆ FillBuffer()

void TString::FillBuffer ( char *&  buffer) const
virtual

Copy string into I/O buffer.

Reimplemented in TStringLong.

Definition at line 1207 of file TString.cxx.

◆ First() [1/2]

Ssiz_t TString::First ( char  c) const

Find first occurrence of a character c.

Definition at line 467 of file TString.cxx.

◆ First() [2/2]

Ssiz_t TString::First ( const char *  cs) const

Find first occurrence of a character in cs.

Definition at line 476 of file TString.cxx.

◆ Form()

void TString::Form ( const char *  fmt,
  ... 
)

Formats a string using a printf style format descriptor.

Existing string contents will be overwritten.

Definition at line 2322 of file TString.cxx.

◆ Format()

TString TString::Format ( const char *  fmt,
  ... 
)
static

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.

Definition at line 2335 of file TString.cxx.

◆ FormImp()

void TString::FormImp ( const char *  fmt,
va_list  ap 
)
private

Formats a string using a printf style format descriptor.

Existing string contents will be overwritten.

Definition at line 2287 of file TString.cxx.

◆ GetInitialCapacity()

Ssiz_t TString::GetInitialCapacity ( )
static

Definition at line 1545 of file TString.cxx.

◆ GetLongCap()

Ssiz_t TString::GetLongCap ( ) const
inlineprivate

Definition at line 230 of file TString.h.

◆ GetLongPointer() [1/2]

char* TString::GetLongPointer ( )
inlineprivate

Definition at line 232 of file TString.h.

◆ GetLongPointer() [2/2]

const char* TString::GetLongPointer ( ) const
inlineprivate

Definition at line 233 of file TString.h.

◆ GetLongSize()

Ssiz_t TString::GetLongSize ( ) const
inlineprivate

Definition at line 227 of file TString.h.

◆ GetMaxWaste()

Ssiz_t TString::GetMaxWaste ( )
static

Definition at line 1561 of file TString.cxx.

◆ GetPointer() [1/2]

char* TString::GetPointer ( )
inlineprivate

Definition at line 236 of file TString.h.

◆ GetPointer() [2/2]

const char* TString::GetPointer ( ) const
inlineprivate

Definition at line 237 of file TString.h.

◆ GetResizeIncrement()

Ssiz_t TString::GetResizeIncrement ( )
static

Definition at line 1553 of file TString.cxx.

◆ Gets()

Bool_t TString::Gets ( FILE *  fp,
Bool_t  chop = kTRUE 
)

Read one line from the stream, including the
, or until EOF.

Remove the trailing []
if chop is true. Returns kTRUE if data was read.

Definition at line 198 of file Stringio.cxx.

◆ GetShortPointer() [1/2]

char* TString::GetShortPointer ( )
inlineprivate

Definition at line 234 of file TString.h.

◆ GetShortPointer() [2/2]

const char* TString::GetShortPointer ( ) const
inlineprivate

Definition at line 235 of file TString.h.

◆ GetShortSize()

Ssiz_t TString::GetShortSize ( ) const
inlineprivate

Definition at line 224 of file TString.h.

◆ Hash() [1/2]

UInt_t TString::Hash ( ECaseCompare  cmp = kExact) const

Return hash value.

Definition at line 606 of file TString.cxx.

◆ Hash() [2/2]

UInt_t TString::Hash ( const void txt,
Int_t  ntxt 
)
static

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:

Definition at line 788 of file TString.cxx.

◆ HashCase()

UInt_t TString::HashCase ( ) const
private

Return a case-sensitive hash value (endian independent).

Definition at line 562 of file TString.cxx.

◆ HashFoldCase()

UInt_t TString::HashFoldCase ( ) const
private

Return a case-insensitive hash value (endian independent).

Definition at line 591 of file TString.cxx.

◆ Index() [1/8]

Ssiz_t TString::Index ( const char *  pat,
Ssiz_t  i = 0,
ECaseCompare  cmp = kExact 
) const
inline

Definition at line 582 of file TString.h.

◆ Index() [2/8]

Ssiz_t TString::Index ( const TString s,
Ssiz_t  i = 0,
ECaseCompare  cmp = kExact 
) const
inline

Definition at line 585 of file TString.h.

◆ Index() [3/8]

Ssiz_t TString::Index ( const char *  pattern,
Ssiz_t  plen,
Ssiz_t  startIndex,
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.

Definition at line 839 of file TString.cxx.

◆ Index() [4/8]

Ssiz_t TString::Index ( const TString s,
Ssiz_t  patlen,
Ssiz_t  i,
ECaseCompare  cmp 
) const
inline

Definition at line 588 of file TString.h.

◆ Index() [5/8]

Ssiz_t TString::Index ( const TRegexp r,
Ssiz_t  start = 0 
) const

Find the first occurrence of the regexp in string and return the position, or -1 if there is no match.

Start is the offset at which the search should start.

Definition at line 250 of file TRegexp.cxx.

◆ Index() [6/8]

Ssiz_t TString::Index ( const TRegexp r,
Ssiz_t extent,
Ssiz_t  start = 0 
) const

Find the first occurrence of the regexp in string and return the position, or -1 if there is no match.

Extent is length of the matched string and start is the offset at which the matching should start.

Definition at line 261 of file TRegexp.cxx.

◆ Index() [7/8]

Ssiz_t TString::Index ( TPRegexp r,
Ssiz_t  start = 0 
) const

Find the first occurrence of the regexp in string and return the position.

Start is the offset at which the search should start.

Definition at line 521 of file TPRegexp.cxx.

◆ Index() [8/8]

Ssiz_t TString::Index ( TPRegexp r,
Ssiz_t extent,
Ssiz_t  start = 0 
) const

Find the first occurrence of the regexp in string and return the position.

Extent is length of the matched string and start is the offset at which the matching should start.

Definition at line 536 of file TPRegexp.cxx.

◆ Init()

char * TString::Init ( Ssiz_t  capacity,
Ssiz_t  nchar 
)
private

Private member function returning an empty string representation of size capacity and containing nchar characters.

Definition at line 218 of file TString.cxx.

◆ InitChar()

void TString::InitChar ( char  c)
protected

Initialize a string with a single character.

Definition at line 136 of file TString.cxx.

◆ InitialCapacity()

Ssiz_t TString::InitialCapacity ( Ssiz_t  ic = 15)
static

Set default initial capacity for all TStrings. Default is 15.

Definition at line 1570 of file TString.cxx.

◆ Insert() [1/4]

TString & TString::Insert ( Ssiz_t  pos,
const char *  s 
)
inline

Definition at line 592 of file TString.h.

◆ Insert() [2/4]

TString & TString::Insert ( Ssiz_t  pos,
const char *  s,
Ssiz_t  extent 
)
inline

Definition at line 595 of file TString.h.

◆ Insert() [3/4]

TString & TString::Insert ( Ssiz_t  pos,
const TString s 
)
inline

Definition at line 598 of file TString.h.

◆ Insert() [4/4]

TString & TString::Insert ( Ssiz_t  pos,
const TString s,
Ssiz_t  extent 
)
inline

Definition at line 601 of file TString.h.

◆ IsAlnum()

Bool_t TString::IsAlnum ( ) const

Returns true if all characters in string are alphanumeric.

Returns false in case string length is 0.

Definition at line 1790 of file TString.cxx.

◆ IsAlpha()

Bool_t TString::IsAlpha ( ) const

Returns true if all characters in string are alphabetic.

Returns false in case string length is 0.

Definition at line 1775 of file TString.cxx.

◆ IsAscii()

Bool_t TString::IsAscii ( ) const

Returns true if all characters in string are ascii.

Definition at line 1762 of file TString.cxx.

◆ IsBin()

Bool_t TString::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.

Definition at line 1885 of file TString.cxx.

◆ IsDec()

Bool_t TString::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.

Definition at line 1917 of file TString.cxx.

◆ IsDigit()

Bool_t TString::IsDigit ( ) const

Returns true if all characters in string are digits (0-9) or white spaces, 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.

Definition at line 1807 of file TString.cxx.

◆ IsFloat()

Bool_t TString::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

Definition at line 1835 of file TString.cxx.

◆ IsHex()

Bool_t TString::IsHex ( ) const

Returns true if all characters in string are hexadecimal digits (0-9,a-f,A-F).

Returns false in case string length is 0 or string contains other characters.

Definition at line 1869 of file TString.cxx.

◆ IsInBaseN()

Bool_t TString::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.

Definition at line 1934 of file TString.cxx.

◆ IsLong()

Bool_t TString::IsLong ( ) const
inlineprivate

Definition at line 218 of file TString.h.

◆ IsNull()

Bool_t TString::IsNull ( ) const
inline

Definition at line 387 of file TString.h.

◆ IsOct()

Bool_t TString::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.

Definition at line 1901 of file TString.cxx.

◆ IsWhitespace()

Bool_t TString::IsWhitespace ( ) const
inline

Definition at line 388 of file TString.h.

◆ Itoa()

TString TString::Itoa ( Int_t  value,
Int_t  base 
)
static

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.

Definition at line 2069 of file TString.cxx.

◆ Last()

Ssiz_t TString::Last ( char  c) const

Find last occurrence of a character c.

Definition at line 865 of file TString.cxx.

◆ Length()

Ssiz_t TString::Length ( ) const
inline

Definition at line 390 of file TString.h.

◆ LLtoa()

TString TString::LLtoa ( Long64_t  value,
Int_t  base 
)
static

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.

Definition at line 2121 of file TString.cxx.

◆ MaxSize()

static Ssiz_t TString::MaxSize ( )
inlinestaticprivate

Definition at line 241 of file TString.h.

◆ MaxWaste()

Ssiz_t TString::MaxWaste ( Ssiz_t  mw = 15)
static

Set maximum space that may be wasted in a string before doing a resize.

Default is 15.

Definition at line 1589 of file TString.cxx.

◆ MaybeRegexp()

Bool_t TString::MaybeRegexp ( ) const

Returns true if string contains one of the regexp characters "^$.[]*+?".

Definition at line 886 of file TString.cxx.

◆ MaybeWildcard()

Bool_t TString::MaybeWildcard ( ) const

Returns true if string contains one of the wildcard characters "[]*?".

Definition at line 898 of file TString.cxx.

◆ MD5()

TString TString::MD5 ( ) const

Return the MD5 digest for this string, in a string representation.

Definition at line 874 of file TString.cxx.

◆ operator const char *()

TString::operator const char * ( ) const
inline

Definition at line 289 of file TString.h.

◆ operator std::string_view()

TString::operator std::string_view ( ) const
inline

Definition at line 290 of file TString.h.

◆ operator()() [1/7]

char & TString::operator() ( Ssiz_t  i)
inline

Definition at line 657 of file TString.h.

◆ operator()() [2/7]

char TString::operator() ( Ssiz_t  i) const
inline

Definition at line 660 of file TString.h.

◆ operator()() [3/7]

TSubString TString::operator() ( Ssiz_t  start,
Ssiz_t  len 
) const

Return sub-string of string starting at start with length len.

Definition at line 1616 of file TString.cxx.

◆ operator()() [4/7]

TSubString TString::operator() ( const TRegexp re) const

Return the substring found by applying the regexp.

Definition at line 279 of file TRegexp.cxx.

◆ operator()() [5/7]

TSubString TString::operator() ( const TRegexp re,
Ssiz_t  start 
) const

Return the substring found by applying the regexp starting at start.

Definition at line 269 of file TRegexp.cxx.

◆ operator()() [6/7]

TSubString TString::operator() ( TPRegexp re) const

Return the substring found by applying the regexp.

Definition at line 562 of file TPRegexp.cxx.

◆ operator()() [7/7]

TSubString TString::operator() ( TPRegexp re,
Ssiz_t  start 
) const

Return the substring found by applying the regexp starting at start.

Definition at line 552 of file TPRegexp.cxx.

◆ operator+=() [1/13]

TString & TString::operator+= ( const char *  s)
inline

Definition at line 504 of file TString.h.

◆ operator+=() [2/13]

TString & TString::operator+= ( const TString s)
inline

Definition at line 507 of file TString.h.

◆ operator+=() [3/13]

TString & TString::operator+= ( char  c)
inline

Definition at line 510 of file TString.h.

◆ operator+=() [4/13]

TString & TString::operator+= ( Short_t  i)
inline

Definition at line 519 of file TString.h.

◆ operator+=() [5/13]

TString & TString::operator+= ( UShort_t  i)
inline

Definition at line 522 of file TString.h.

◆ operator+=() [6/13]

TString & TString::operator+= ( Int_t  i)
inline

Definition at line 525 of file TString.h.

◆ operator+=() [7/13]

TString & TString::operator+= ( UInt_t  i)
inline

Definition at line 528 of file TString.h.

◆ operator+=() [8/13]

TString & TString::operator+= ( Long_t  i)
inline

Definition at line 513 of file TString.h.

◆ operator+=() [9/13]

TString & TString::operator+= ( ULong_t  i)
inline

Definition at line 516 of file TString.h.

◆ operator+=() [10/13]

TString & TString::operator+= ( Float_t  f)
inline

Definition at line 539 of file TString.h.

◆ operator+=() [11/13]

TString & TString::operator+= ( Double_t  f)
inline

Definition at line 531 of file TString.h.

◆ operator+=() [12/13]

TString & TString::operator+= ( Long64_t  i)
inline

Definition at line 542 of file TString.h.

◆ operator+=() [13/13]

TString & TString::operator+= ( ULong64_t  i)
inline

Definition at line 550 of file TString.h.

◆ operator=() [1/6]

TString & TString::operator= ( char  s)

Assign character c to TString.

Definition at line 246 of file TString.cxx.

◆ operator=() [2/6]

TString & TString::operator= ( const char *  s)

Assign string cs to TString.

Definition at line 259 of file TString.cxx.

◆ operator=() [3/6]

TString & TString::operator= ( const TString s)

Assignment operator.

Definition at line 298 of file TString.cxx.

◆ operator=() [4/6]

TString & TString::operator= ( const std::string &  s)

Assign std::string s to TString.

Definition at line 272 of file TString.cxx.

◆ operator=() [5/6]

TString & TString::operator= ( const std::string_view s)

Assign std::string s to TString.

Definition at line 285 of file TString.cxx.

◆ operator=() [6/6]

TString & TString::operator= ( const TSubString s)

Assign a TSubString substr to TString.

Definition at line 316 of file TString.cxx.

◆ operator[]() [1/2]

char & TString::operator[] ( Ssiz_t  i)
inline

Definition at line 663 of file TString.h.

◆ operator[]() [2/2]

char TString::operator[] ( Ssiz_t  i) const
inline

Definition at line 666 of file TString.h.

◆ Prepend() [1/5]

TString & TString::Prepend ( const char *  cs)
inline

Definition at line 604 of file TString.h.

◆ Prepend() [2/5]

TString & TString::Prepend ( const char *  cs,
Ssiz_t  n 
)
inline

Definition at line 607 of file TString.h.

◆ Prepend() [3/5]

TString & TString::Prepend ( const TString s)
inline

Definition at line 610 of file TString.h.

◆ Prepend() [4/5]

TString & TString::Prepend ( const TString s,
Ssiz_t  n 
)
inline

Definition at line 613 of file TString.h.

◆ Prepend() [5/5]

TString & TString::Prepend ( char  c,
Ssiz_t  rep = 1 
)

Prepend character c rep times to string.

Definition at line 910 of file TString.cxx.

◆ Puts()

void TString::Puts ( FILE *  fp)

Write string to the stream.

Definition at line 223 of file Stringio.cxx.

◆ ReadBuffer()

void TString::ReadBuffer ( char *&  buffer)
virtual

Read string from I/O buffer.

Reimplemented in TStringLong.

Definition at line 1228 of file TString.cxx.

◆ ReadFile()

std::istream & TString::ReadFile ( std::istream &  str)

Replace string with the contents of strm, stopping at an EOF.

Definition at line 28 of file Stringio.cxx.

◆ ReadLine()

std::istream & TString::ReadLine ( std::istream &  str,
Bool_t  skipWhite = kTRUE 
)

Read a line from stream upto newline skipping any whitespace.

Definition at line 65 of file Stringio.cxx.

◆ ReadString() [1/2]

TString * TString::ReadString ( TBuffer b,
const TClass clReq 
)
static

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.

Definition at line 1259 of file TString.cxx.

◆ ReadString() [2/2]

std::istream & TString::ReadString ( std::istream &  str)

Read a line from stream upto \0, including any newline.

Definition at line 76 of file Stringio.cxx.

◆ ReadToDelim()

std::istream & TString::ReadToDelim ( std::istream &  strm,
char  delim = '\n' 
)

Read up to an EOF, or a delimiting character, whichever comes first.

The delimiter is not stored in the string, but is removed from the input stream. Because we don't know how big a string to expect, we first read as much as we can and then, if the EOF or null hasn't been encountered, do a resize and keep reading.

Definition at line 89 of file Stringio.cxx.

◆ ReadToken()

std::istream & TString::ReadToken ( std::istream &  str)

Read a token, delimited by whitespace, from the input stream.

Definition at line 127 of file Stringio.cxx.

◆ Recommend()

static Ssiz_t TString::Recommend ( Ssiz_t  s)
inlinestaticprotected

Definition at line 214 of file TString.h.

◆ Remove() [1/3]

TString & TString::Remove ( Ssiz_t  pos)
inline

Definition at line 616 of file TString.h.

◆ Remove() [2/3]

TString & TString::Remove ( Ssiz_t  pos,
Ssiz_t  n 
)
inline

Definition at line 619 of file TString.h.

◆ Remove() [3/3]

TString & TString::Remove ( EStripType  st,
char  c 
)

Remove char c at begin and/or end of string (like Strip()) but modifies directly the string.

Definition at line 1031 of file TString.cxx.

◆ Replace() [1/4]

TString & TString::Replace ( Ssiz_t  pos,
Ssiz_t  n,
const char *  s 
)
inline

Definition at line 625 of file TString.h.

◆ Replace() [2/4]

TString & TString::Replace ( Ssiz_t  pos,
Ssiz_t  n1,
const char *  cs,
Ssiz_t  n2 
)

Remove at most n1 characters from self beginning at pos, and replace them with the first n2 characters of cs.

Definition at line 951 of file TString.cxx.

◆ Replace() [3/4]

TString & TString::Replace ( Ssiz_t  pos,
Ssiz_t  n,
const TString s 
)
inline

Definition at line 628 of file TString.h.

◆ Replace() [4/4]

TString & TString::Replace ( Ssiz_t  pos,
Ssiz_t  n1,
const TString s,
Ssiz_t  n2 
)
inline

Definition at line 631 of file TString.h.

◆ ReplaceAll() [1/5]

TString & TString::ReplaceAll ( const TString s1,
const TString s2 
)
inline

Definition at line 635 of file TString.h.

◆ ReplaceAll() [2/5]

TString & TString::ReplaceAll ( const TString s1,
const char *  s2 
)
inline

Definition at line 638 of file TString.h.

◆ ReplaceAll() [3/5]

TString & TString::ReplaceAll ( const char *  s1,
const TString s2 
)
inline

Definition at line 641 of file TString.h.

◆ ReplaceAll() [4/5]

TString & TString::ReplaceAll ( const char *  s1,
const char *  s2 
)
inline

Definition at line 644 of file TString.h.

◆ ReplaceAll() [5/5]

TString & 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.

Definition at line 1014 of file TString.cxx.

◆ Resize()

void TString::Resize ( Ssiz_t  n)

Resize the string. Truncate or add blanks as necessary.

Definition at line 1059 of file TString.cxx.

◆ ResizeIncrement()

Ssiz_t TString::ResizeIncrement ( Ssiz_t  ri = 16)
static

Set default resize increment for all TStrings. Default is 16.

Definition at line 1579 of file TString.cxx.

◆ SetLongCap()

void TString::SetLongCap ( Ssiz_t  s)
inlineprivate

Definition at line 229 of file TString.h.

◆ SetLongPointer()

void TString::SetLongPointer ( char *  p)
inlineprivate

Definition at line 231 of file TString.h.

◆ SetLongSize()

void TString::SetLongSize ( Ssiz_t  s)
inlineprivate

Definition at line 226 of file TString.h.

◆ SetShortSize()

void TString::SetShortSize ( Ssiz_t  s)
inlineprivate

Definition at line 223 of file TString.h.

◆ SetSize()

void TString::SetSize ( Ssiz_t  s)
inlineprivate

Definition at line 228 of file TString.h.

◆ Sizeof()

Int_t TString::Sizeof ( ) const
virtual

Returns size string will occupy on I/O buffer.

Reimplemented in TStringLong.

Definition at line 1298 of file TString.cxx.

◆ Strip()

TSubString TString::Strip ( EStripType  s = kTrailing,
char  c = ' ' 
) const

Return a substring of self stripped at beginning and/or end.

Definition at line 1070 of file TString.cxx.

◆ SubString()

TSubString TString::SubString ( const char *  pattern,
Ssiz_t  startIndex = 0,
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).

Definition at line 1634 of file TString.cxx.

◆ Swap()

TString & TString::Swap ( TString other)
inline

Definition at line 647 of file TString.h.

◆ Tokenize() [1/2]

TObjArray * TString::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.

Definition at line 2241 of file TString.cxx.

◆ Tokenize() [2/2]

Bool_t TString::Tokenize ( TString tok,
Ssiz_t from,
const char *  delim = " " 
) const

Search for tokens delimited by regular expression 'delim' (default " ") in this string; search starts at 'from' and the token is returned in 'tok'.

Returns in 'from' the next position after the delimiter. Returns kTRUE if a token is found, kFALSE if not or if some inconsistency occurred. This method allows to loop over tokens in this way:

TString myl = "tok1 tok2|tok3";
TString tok;
Ssiz_t from = 0;
while (myl.Tokenize(tok, from, "[ |]")) {
// Analyse tok
...
}

more convenient of the other Tokenize method when saving the tokens is not needed.

Definition at line 303 of file TRegexp.cxx.

◆ ToLower()

void TString::ToLower ( )

Change string to lower-case.

Definition at line 1089 of file TString.cxx.

◆ ToUpper()

void TString::ToUpper ( )

Change string to upper case.

Definition at line 1102 of file TString.cxx.

◆ UItoa()

TString TString::UItoa ( UInt_t  value,
Int_t  base 
)
static

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.

Definition at line 2096 of file TString.cxx.

◆ ULLtoa()

TString TString::ULLtoa ( ULong64_t  value,
Int_t  base 
)
static

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.

Definition at line 2148 of file TString.cxx.

◆ UnLink()

void TString::UnLink ( ) const
inlineprivate

Definition at line 243 of file TString.h.

◆ WriteString()

void TString::WriteString ( TBuffer b,
const TString a 
)
static

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

Definition at line 1325 of file TString.cxx.

◆ Zero()

void TString::Zero ( )
inlineprivate

Definition at line 244 of file TString.h.

Friends And Related Function Documentation

◆ operator+ [1/13]

TString operator+ ( const TString s1,
const TString s2 
)
friend

Use the special concatenation constructor.

Definition at line 1438 of file TString.cxx.

◆ operator+ [2/13]

TString operator+ ( const TString s,
const char *  cs 
)
friend

Use the special concatenation constructor.

Definition at line 1422 of file TString.cxx.

◆ operator+ [3/13]

TString operator+ ( const char *  cs,
const TString s 
)
friend

Use the special concatenation constructor.

Definition at line 1430 of file TString.cxx.

◆ operator+ [4/13]

TString operator+ ( const TString s,
char  c 
)
friend

Add char to string.

Definition at line 1446 of file TString.cxx.

◆ operator+ [5/13]

TString operator+ ( const TString s,
Long_t  i 
)
friend

Add integer to string.

Definition at line 1454 of file TString.cxx.

◆ operator+ [6/13]

TString operator+ ( const TString s,
ULong_t  i 
)
friend

Add integer to string.

Definition at line 1464 of file TString.cxx.

◆ operator+ [7/13]

TString operator+ ( const TString s,
Long64_t  i 
)
friend

Add integer to string.

Definition at line 1474 of file TString.cxx.

◆ operator+ [8/13]

TString operator+ ( const TString s,
ULong64_t  i 
)
friend

Add integer to string.

Definition at line 1484 of file TString.cxx.

◆ operator+ [9/13]

TString operator+ ( char  c,
const TString s 
)
friend

Add string to integer.

Definition at line 1494 of file TString.cxx.

◆ operator+ [10/13]

TString operator+ ( Long_t  i,
const TString s 
)
friend

Add string to integer.

Definition at line 1502 of file TString.cxx.

◆ operator+ [11/13]

TString operator+ ( ULong_t  i,
const TString s 
)
friend

Add string to integer.

Definition at line 1512 of file TString.cxx.

◆ operator+ [12/13]

TString operator+ ( Long64_t  i,
const TString s 
)
friend

Add string to integer.

Definition at line 1522 of file TString.cxx.

◆ operator+ [13/13]

TString operator+ ( ULong64_t  i,
const TString s 
)
friend

Add string to integer.

Definition at line 1532 of file TString.cxx.

◆ operator<<

TBuffer& operator<< ( TBuffer b,
const TString obj 
)
friend

Write TString or derived to TBuffer.

Definition at line 1367 of file TString.cxx.

◆ operator== [1/2]

Bool_t operator== ( const TString s1,
const TString s2 
)
friend

Definition at line 700 of file TString.h.

◆ operator== [2/2]

Bool_t operator== ( const TString s1,
const char *  s2 
)
friend

Compare TString with a char *.

Definition at line 1379 of file TString.cxx.

◆ TBufferFile

friend class TBufferFile
friend

Definition at line 141 of file TString.h.

◆ TStringLong

friend class TStringLong
friend

Definition at line 139 of file TString.h.

◆ TSubString

friend class TSubString
friend

Definition at line 140 of file TString.h.

Member Data Documentation

◆ fRep

Rep_t TString::fRep
protected

Definition at line 203 of file TString.h.

◆ kNPOS

const Ssiz_t TString::kNPOS = ::kNPOS
static

Definition at line 258 of file TString.h.


The documentation for this class was generated from the following files: