Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
TGString Class Reference

TGString wraps a TString and adds some graphics routines like drawing, size of string on screen depending on font, etc.

Definition at line 20 of file TGString.h.

Public Types

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

Public Member Functions

 TGString ()
 TGString (const char *s)
 TGString (const TGString *s)
 constructor
 TGString (Int_t number)
 ~TGString () override
TStringAppend (char c, Ssiz_t rep=1)
 Append character c rep times to string.
TStringAppend (const char *cs)
TStringAppend (const char *cs, Ssiz_t n)
TStringAppend (const TString &s)
TStringAppend (const TString &s, Ssiz_t n)
Double_t Atof () const
 Return floating-point value contained in string.
Int_t Atoi () const
 Return integer value of string.
Long64_t Atoll () const
 Return long long value of string.
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.
TStringChop ()
void Clear ()
 Clear string without changing its capacity.
int CompareTo (const char *cs, ECaseCompare cmp=kExact) const
 Compare a string to char *cs2.
int CompareTo (const TString &st, ECaseCompare cmp=kExact) const
 Compare a string to another string.
Bool_t Contains (const char *pat, ECaseCompare cmp=kExact) const
Bool_t Contains (const TRegexp &pat) const
 Returns whether the string matches the input TRegexp.
Bool_t Contains (const TString &pat, ECaseCompare cmp=kExact) const
Bool_t Contains (TPRegexp &pat) const
TString Copy () const
 Copy a string.
Int_t CountChar (Int_t c) const
 Return number of times character c occurs in the string.
const char * Data () const
virtual void Draw (Drawable_t id, GContext_t gc, Int_t x, Int_t y)
 Draw string.
virtual void DrawWrapped (Drawable_t id, GContext_t gc, Int_t x, Int_t y, UInt_t w, FontStruct_t font)
 Draw a string in a column with width w.
Bool_t EndsWith (const char *pat, ECaseCompare cmp=kExact) const
 Return true if string ends with the specified string.
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.
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.
void Form (const char *fmt,...)
 Formats a string using a printf style format descriptor.
Int_t GetLength () const
virtual Int_t GetLines (FontStruct_t font, UInt_t w)
 Get number of lines of width w the string would take using a certain font.
Bool_t Gets (FILE *fp, Bool_t chop=kTRUE)
 Read one line from the stream, including the \n, or until EOF.
const char * GetString () const
UInt_t Hash (ECaseCompare cmp=kExact) const
 Return hash value.
Ssiz_t Index (const char *pat, 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.
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.
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.
Ssiz_t Index (const TString &s, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Ssiz_t Index (const TString &s, Ssiz_t patlen, Ssiz_t i, ECaseCompare cmp) const
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.
Ssiz_t Index (TPRegexp &pat, Ssiz_t i=0) const
 Find the first occurrence of the regexp in string and return the position.
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)
TClassIsA () const override
Bool_t IsAlnum () const
 Returns true if all characters in string are alphanumeric.
Bool_t IsAlpha () const
 Returns true if all characters in string are alphabetic.
Bool_t IsAscii () const
 Returns true if all characters in string are ascii.
Bool_t IsBin () const
 Returns true if all characters in string are binary digits (0,1).
Bool_t IsDec () const
 Returns true if all characters in string are decimal digits (0-9).
Bool_t IsDigit () const
 Returns true if all characters in string are digits (0-9) or white spaces, i.e.
Bool_t IsFloat () const
 Returns kTRUE if string contains a floating point or integer number.
Bool_t IsHex () const
 Returns true if all characters in string are hexadecimal digits (0-9,a-f,A-F).
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.
Bool_t IsNull () const
Bool_t IsOct () const
 Returns true if all characters in string are octal digits (0-7).
Bool_t IsWhitespace () const
Ssiz_t Last (char c) const
 Find last occurrence of a character c.
Ssiz_t Length () const
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 MD5 () const
 Return the MD5 digest for this string, in a string representation.
 operator const char * () const
TSubString operator() (const TRegexp &re) const
 Return the substring found by applying the regexp.
TSubString operator() (const TRegexp &re, Ssiz_t start) const
 Return the substring found by applying the regexp starting at start.
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.
TSubString operator() (TPRegexp &re) const
 Return the substring found by applying the regexp.
TSubString operator() (TPRegexp &re, Ssiz_t start) const
 Return the substring found by applying the regexp starting at start.
TStringoperator+= (char c)
TStringoperator+= (const char *s)
TStringoperator+= (const TString &s)
template<class T>
std::enable_if< ROOT::TypeTraits::IsFloatNumeral< T >::value, TString >::type & operator+= (T f)
template<class T>
std::enable_if< ROOT::TypeTraits::IsSignedNumeral< T >::value, TString >::type & operator+= (T i)
template<class T>
std::enable_if< ROOT::TypeTraits::IsUnsignedNumeral< T >::value, TString >::type & operator+= (T u)
char & operator[] (Ssiz_t i)
char operator[] (Ssiz_t i) const
TStringPrepend (char c, Ssiz_t rep=1)
 Prepend character c rep times to string.
TStringPrepend (const char *cs)
TStringPrepend (const char *cs, Ssiz_t n)
TStringPrepend (const TString &s)
TStringPrepend (const TString &s, Ssiz_t n)
void Puts (FILE *fp)
 Write string to the stream.
virtual void ReadBuffer (char *&buffer)
 Read string from I/O buffer.
std::istream & ReadFile (std::istream &str)
 Replace string with the contents of strm, stopping at an EOF.
std::istream & ReadLine (std::istream &str, Bool_t skipWhite=kTRUE)
 Read a line from stream upto newline skipping any whitespace.
std::istream & ReadString (std::istream &str)
 Read a line from stream upto \0, including any newline.
std::istream & ReadToDelim (std::istream &str, char delim='\n')
 Read up to an EOF, or a delimiting character, whichever comes first.
std::istream & ReadToken (std::istream &str)
 Read a token, delimited by whitespace, from the input stream.
TStringRemove (EStripType s, char c)
 Remove char c at begin and/or end of string (like Strip()) but modifies directly the string.
TStringRemove (Ssiz_t pos)
TStringRemove (Ssiz_t pos, Ssiz_t n)
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.
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 char *s1, const char *s2)
TStringReplaceAll (const char *s1, const TString &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.
TStringReplaceAll (const TString &s1, const char *s2)
TStringReplaceAll (const TString &s1, const TString &s2)
TStringReplaceSpecialCppChars ()
 Find special characters which are typically used in printf() calls and replace them by appropriate escape sequences.
void Resize (Ssiz_t n)
 Resize the string. Truncate or add blanks as necessary.
virtual void SetString (const char *s)
std::size_t size () const
virtual Int_t Sizeof () const
 Returns size string will occupy on I/O buffer.
void Streamer (TBuffer &) override
 Stream a string object.
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
TSubString Strip (EStripType s=kTrailing, char c=' ') const
 Return a substring of self stripped at beginning and/or end.
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.
TStringSwap (TString &other)
TObjArrayTokenize (const TString &delim) const
 This function is used to isolate sequential tokens in a TString.
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'.
void ToLower ()
 Change string to lower-case.
void ToUpper ()
 Change string to upper case.
std::string_view View () const

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

Static Public Attributes

static constexpr Ssiz_t kNPOS = ::kNPOS

Protected Types

enum  { kAlignment = 16 }

Protected Member Functions

void AssertElement (Ssiz_t nc) const
 Check to make sure a string index is in range.
Ssiz_t Clobber (Ssiz_t nc)
 Clear string and make sure it has a capacity of nc.
void InitChar (char c)
 Initialize a string with a single character.

Static Protected Member Functions

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

Protected Attributes

Rep_t fRep
 ! String data

Private Types

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

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.
void FormImp (const char *fmt, va_list ap)
 Formats a string using a printf style format descriptor.
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).
UInt_t HashFoldCase () const
 Return a case-insensitive hash value (endian independent).
char * Init (Ssiz_t capacity, Ssiz_t nchar)
 Private member function returning an empty string representation of size capacity and containing nchar characters.
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 constexpr Ssiz_t MaxSize ()

#include <TGString.h>

Inheritance diagram for TGString:
TString TGHotString

Member Typedef Documentation

◆ size_type

using TString::size_type = Ssiz_t
inherited

Definition at line 287 of file TString.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
privateinherited
Enumerator
kShortMask 
kLongMask 

Definition at line 184 of file TString.h.

◆ anonymous enum

anonymous enum
privateinherited

Definition at line 194 of file TString.h.

◆ anonymous enum

anonymous enum
protectedinherited
Enumerator
kAlignment 

Definition at line 231 of file TString.h.

◆ anonymous enum

anonymous enum
privateinherited
Enumerator
kNwords 

Definition at line 205 of file TString.h.

◆ ECaseCompare

enum TString::ECaseCompare
inherited
Enumerator
kExact 
kIgnoreCase 

Definition at line 285 of file TString.h.

◆ EStripType

enum TString::EStripType
inherited
Enumerator
kLeading 
kTrailing 
kBoth 

Definition at line 284 of file TString.h.

Constructor & Destructor Documentation

◆ TGString() [1/4]

TGString::TGString ( )
inline

Definition at line 23 of file TGString.h.

◆ TGString() [2/4]

TGString::TGString ( const char * s)
inline

Definition at line 24 of file TGString.h.

◆ TGString() [3/4]

TGString::TGString ( Int_t number)
inline

Definition at line 25 of file TGString.h.

◆ TGString() [4/4]

TGString::TGString ( const TGString * s)

constructor

Definition at line 47 of file TGString.cxx.

◆ ~TGString()

TGString::~TGString ( )
inlineoverride

Definition at line 27 of file TGString.h.

Member Function Documentation

◆ AdjustCapacity()

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

Calculate a nice capacity greater than or equal to newCap.

Warning
Fatal() is raised if newCap > MaxSize()
Returns
Resulting recommended capacity (after clamping, if needed)

Definition at line 1227 of file TString.cxx.

◆ Align()

Ssiz_t TString::Align ( Ssiz_t s)
inlinestaticprotectedinherited

Definition at line 232 of file TString.h.

◆ Append() [1/5]

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

Append character c rep times to string.

Warning
If length+rep exceeds MaxSize(), then Fatal() is raised and only MaxSize()-length elements are added

Definition at line 404 of file TString.cxx.

◆ Append() [2/5]

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

Definition at line 581 of file TString.h.

◆ Append() [3/5]

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

Definition at line 584 of file TString.h.

◆ Append() [4/5]

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

Definition at line 587 of file TString.h.

◆ Append() [5/5]

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

Definition at line 590 of file TString.h.

◆ AssertElement()

void TString::AssertElement ( Ssiz_t nc) const
protectedinherited

Check to make sure a string index is in range.

Definition at line 1215 of file TString.cxx.

◆ Atof()

Double_t TString::Atof ( ) const
inherited

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
#define e(i)
Definition RSha256.hxx:103

Definition at line 2060 of file TString.cxx.

◆ Atoi()

Int_t TString::Atoi ( ) const
inherited

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 1994 of file TString.cxx.

◆ Atoll()

Long64_t TString::Atoll ( ) const
inherited

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 2020 of file TString.cxx.

◆ BaseConvert()

TString TString::BaseConvert ( const TString & s_in,
Int_t base_in,
Int_t base_out )
staticinherited

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 2200 of file TString.cxx.

◆ BeginsWith() [1/2]

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

Definition at line 632 of file TString.h.

◆ BeginsWith() [2/2]

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

Definition at line 635 of file TString.h.

◆ Capacity() [1/2]

Ssiz_t TString::Capacity ( ) const
inlineinherited

Definition at line 372 of file TString.h.

◆ Capacity() [2/2]

Ssiz_t TString::Capacity ( Ssiz_t nc)
inherited

Return string capacity.

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

Definition at line 449 of file TString.cxx.

◆ Chop()

TString & TString::Chop ( )
inlineinherited

Definition at line 700 of file TString.h.

◆ Class()

TClass * TGString::Class ( )
static
Returns
TClass describing this class

◆ Class_Name()

const char * TGString::Class_Name ( )
static
Returns
Name of this class

◆ Class_Version()

constexpr Version_t TGString::Class_Version ( )
inlinestaticconstexpr
Returns
Version of this class

Definition at line 38 of file TGString.h.

◆ Clear()

void TString::Clear ( )
inherited

Clear string without changing its capacity.

Definition at line 1241 of file TString.cxx.

◆ Clobber()

Ssiz_t TString::Clobber ( Ssiz_t nc)
protectedinherited

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

Warning
If nc > MaxSize(), then Fatal() is raised, and only MaxSize() elements are allocated if Fatal does not abort
Returns
Resulting allocated capacity (after clamping, if needed)

Definition at line 1252 of file TString.cxx.

◆ Clone()

void TString::Clone ( Ssiz_t tot)
privateinherited

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

Preserve previous contents.

Warning
If tot > MaxSize(), then Fatal() is raised and only MaxSize() elements are allocated

Definition at line 1285 of file TString.cxx.

◆ CompareTo() [1/2]

int TString::CompareTo ( const char * cs2,
ECaseCompare cmp = kExact ) const
inherited

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 464 of file TString.cxx.

◆ CompareTo() [2/2]

int TString::CompareTo ( const TString & str,
ECaseCompare cmp = kExact ) const
inherited

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 494 of file TString.cxx.

◆ Contains() [1/4]

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

Definition at line 641 of file TString.h.

◆ Contains() [2/4]

Bool_t TString::Contains ( const TRegexp & pat) const
inlineinherited

Returns whether the string matches the input TRegexp.

Warning
Matching regular expressions of type ".?" is not supported. Use std::regex instead.

Definition at line 648 of file TString.h.

◆ Contains() [3/4]

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

Definition at line 638 of file TString.h.

◆ Contains() [4/4]

Bool_t TString::Contains ( TPRegexp & pat) const
inlineinherited

Definition at line 651 of file TString.h.

◆ Copy()

TString TString::Copy ( ) const
inherited

Copy a string.

Definition at line 536 of file TString.cxx.

◆ CountChar()

Int_t TString::CountChar ( Int_t c) const
inherited

Return number of times character c occurs in the string.

Definition at line 522 of file TString.cxx.

◆ Data()

const char * TString::Data ( ) const
inlineinherited

Definition at line 384 of file TString.h.

◆ DeclFileName()

const char * TGString::DeclFileName ( )
inlinestatic
Returns
Name of the file containing the class declaration

Definition at line 38 of file TGString.h.

◆ Draw()

void TGString::Draw ( Drawable_t id,
GContext_t gc,
Int_t x,
Int_t y )
virtual

Draw string.

Reimplemented in TGHotString.

Definition at line 54 of file TGString.cxx.

◆ DrawWrapped()

void TGString::DrawWrapped ( Drawable_t id,
GContext_t gc,
Int_t x,
Int_t y,
UInt_t w,
FontStruct_t font )
virtual

Draw a string in a column with width w.

If string is longer than w wrap it to next line.

Reimplemented in TGHotString.

Definition at line 63 of file TGString.cxx.

◆ EndsWith()

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

Return true if string ends with the specified string.

Definition at line 2250 of file TString.cxx.

◆ EqualTo() [1/2]

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

Definition at line 654 of file TString.h.

◆ EqualTo() [2/2]

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

Definition at line 657 of file TString.h.

◆ FillBuffer()

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

Copy string into I/O buffer.

Definition at line 1316 of file TString.cxx.

◆ First() [1/2]

Ssiz_t TString::First ( char c) const
inherited

Find first occurrence of a character c.

Definition at line 545 of file TString.cxx.

◆ First() [2/2]

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

Find first occurrence of a character in cs.

Definition at line 554 of file TString.cxx.

◆ Form()

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

Formats a string using a printf style format descriptor.

Existing string contents will be overwritten. See also the static version TString::Format

TString formatted;
formatted.Form("%s in <%s>: %s", type, location, msg);
lines.emplace_back(TString::Format("Welcome to ROOT %s%%shttp://root.cern",
gROOT->GetVersion()));
#define gROOT
Definition TROOT.h:417
TString(const char *a1, Ssiz_t n1, const char *a2, Ssiz_t n2)
Special constructor to initialize with the concatenation of a1 and a2.
Definition TString.cxx:230
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2385
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition TString.cxx:2363

Note: this is not to be confused with Format and Form (in the global namespace) which returns a const char* and relies on a thread-local static character buffer.

Definition at line 2363 of file TString.cxx.

◆ Format()

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

Static method which formats a string using a printf style format descriptor and return a TString.

Similar to TString::Form() but it is not needed to first create a TString.

lines.emplace_back(TString::Format("Welcome to ROOT %s%%shttp://root.cern",
gROOT->GetVersion()));
TString formatted;
formatted.Form("%s in <%s>: %s", type, location, msg);

Note: this is not to be confused with Format and Form (in the global namespace) which returns a const char* and relies on a thread-local static character buffer.

Definition at line 2385 of file TString.cxx.

◆ FormImp()

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

Formats a string using a printf style format descriptor.

Existing string contents will be overwritten.

Definition at line 2316 of file TString.cxx.

◆ GetInitialCapacity()

Ssiz_t TString::GetInitialCapacity ( )
staticinherited

Definition at line 1574 of file TString.cxx.

◆ GetLength()

Int_t TGString::GetLength ( ) const
inline

Definition at line 29 of file TGString.h.

◆ GetLines()

Int_t TGString::GetLines ( FontStruct_t font,
UInt_t w )
virtual

Get number of lines of width w the string would take using a certain font.

Definition at line 105 of file TGString.cxx.

◆ GetLongCap()

Ssiz_t TString::GetLongCap ( ) const
inlineprivateinherited

Definition at line 258 of file TString.h.

◆ GetLongPointer() [1/2]

char * TString::GetLongPointer ( )
inlineprivateinherited

Definition at line 260 of file TString.h.

◆ GetLongPointer() [2/2]

const char * TString::GetLongPointer ( ) const
inlineprivateinherited

Definition at line 261 of file TString.h.

◆ GetLongSize()

Ssiz_t TString::GetLongSize ( ) const
inlineprivateinherited

Definition at line 255 of file TString.h.

◆ GetMaxWaste()

Ssiz_t TString::GetMaxWaste ( )
staticinherited

Definition at line 1590 of file TString.cxx.

◆ GetPointer() [1/2]

char * TString::GetPointer ( )
inlineprivateinherited

Definition at line 264 of file TString.h.

◆ GetPointer() [2/2]

const char * TString::GetPointer ( ) const
inlineprivateinherited

Definition at line 265 of file TString.h.

◆ GetResizeIncrement()

Ssiz_t TString::GetResizeIncrement ( )
staticinherited

Definition at line 1582 of file TString.cxx.

◆ Gets()

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

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

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

Definition at line 204 of file Stringio.cxx.

◆ GetShortPointer() [1/2]

char * TString::GetShortPointer ( )
inlineprivateinherited

Definition at line 262 of file TString.h.

◆ GetShortPointer() [2/2]

const char * TString::GetShortPointer ( ) const
inlineprivateinherited

Definition at line 263 of file TString.h.

◆ GetShortSize()

Ssiz_t TString::GetShortSize ( ) const
inlineprivateinherited

Definition at line 252 of file TString.h.

◆ GetString()

const char * TGString::GetString ( ) const
inline

Definition at line 30 of file TGString.h.

◆ Hash() [1/2]

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

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 857 of file TString.cxx.

◆ Hash() [2/2]

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

Return hash value.

Definition at line 684 of file TString.cxx.

◆ HashCase()

UInt_t TString::HashCase ( ) const
privateinherited

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

Definition at line 640 of file TString.cxx.

◆ HashFoldCase()

UInt_t TString::HashFoldCase ( ) const
privateinherited

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

Definition at line 669 of file TString.cxx.

◆ Index() [1/8]

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

Definition at line 660 of file TString.h.

◆ Index() [2/8]

Ssiz_t TString::Index ( const char * pattern,
Ssiz_t plen,
Ssiz_t startIndex,
ECaseCompare cmp ) const
inherited

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 908 of file TString.cxx.

◆ Index() [3/8]

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

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. Please, see the Warning in the class documentation above.

Definition at line 267 of file TRegexp.cxx.

◆ Index() [4/8]

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

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. Please, see the Warning in the class documentation above.

Definition at line 255 of file TRegexp.cxx.

◆ Index() [5/8]

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

Definition at line 663 of file TString.h.

◆ Index() [6/8]

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

Definition at line 666 of file TString.h.

◆ Index() [7/8]

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

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 627 of file TPRegexp.cxx.

◆ Index() [8/8]

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

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 612 of file TPRegexp.cxx.

◆ Init()

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

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

Warning
If nchar > MaxSize(), then Fatal() is raised and only MaxSize() elements are allocated

Definition at line 268 of file TString.cxx.

◆ InitChar()

void TString::InitChar ( char c)
protectedinherited

Initialize a string with a single character.

Definition at line 155 of file TString.cxx.

◆ InitialCapacity()

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

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

Definition at line 1599 of file TString.cxx.

◆ Insert() [1/4]

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

Definition at line 670 of file TString.h.

◆ Insert() [2/4]

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

Definition at line 673 of file TString.h.

◆ Insert() [3/4]

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

Definition at line 676 of file TString.h.

◆ Insert() [4/4]

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

Definition at line 679 of file TString.h.

◆ IsA()

TClass * TGString::IsA ( ) const
inlineoverridevirtual
Returns
TClass describing current object

Reimplemented from TString.

Definition at line 38 of file TGString.h.

◆ IsAlnum()

Bool_t TString::IsAlnum ( ) const
inherited

Returns true if all characters in string are alphanumeric.

Returns false in case string length is 0.

Definition at line 1819 of file TString.cxx.

◆ IsAlpha()

Bool_t TString::IsAlpha ( ) const
inherited

Returns true if all characters in string are alphabetic.

Returns false in case string length is 0.

Definition at line 1804 of file TString.cxx.

◆ IsAscii()

Bool_t TString::IsAscii ( ) const
inherited

Returns true if all characters in string are ascii.

Definition at line 1791 of file TString.cxx.

◆ IsBin()

Bool_t TString::IsBin ( ) const
inherited

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 1914 of file TString.cxx.

◆ IsDec()

Bool_t TString::IsDec ( ) const
inherited

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 1946 of file TString.cxx.

◆ IsDigit()

Bool_t TString::IsDigit ( ) const
inherited

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 1836 of file TString.cxx.

◆ IsFloat()

Bool_t TString::IsFloat ( ) const
inherited

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 1864 of file TString.cxx.

◆ IsHex()

Bool_t TString::IsHex ( ) const
inherited

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 1898 of file TString.cxx.

◆ IsInBaseN()

Bool_t TString::IsInBaseN ( Int_t base) const
inherited

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 1963 of file TString.cxx.

◆ IsLong()

Bool_t TString::IsLong ( ) const
inlineprivateinherited

Definition at line 246 of file TString.h.

◆ IsNull()

Bool_t TString::IsNull ( ) const
inlineinherited

Definition at line 422 of file TString.h.

◆ IsOct()

Bool_t TString::IsOct ( ) const
inherited

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 1930 of file TString.cxx.

◆ IsWhitespace()

Bool_t TString::IsWhitespace ( ) const
inlineinherited

Definition at line 423 of file TString.h.

◆ Itoa()

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

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
static TString Itoa(Int_t value, Int_t base)
Converts an Int_t to a TString with respect to the base specified (2-36).
Definition TString.cxx:2098

In case of error returns the "!" string.

Definition at line 2098 of file TString.cxx.

◆ Last()

Ssiz_t TString::Last ( char c) const
inherited

Find last occurrence of a character c.

Definition at line 938 of file TString.cxx.

◆ Length()

Ssiz_t TString::Length ( ) const
inlineinherited

Definition at line 425 of file TString.h.

◆ LLtoa()

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

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 2150 of file TString.cxx.

◆ MaxSize()

constexpr Ssiz_t TString::MaxSize ( )
inlinestaticconstexprprivateinherited

Definition at line 269 of file TString.h.

◆ MaxWaste()

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

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

Default is 15.

Definition at line 1618 of file TString.cxx.

◆ MaybeRegexp()

Bool_t TString::MaybeRegexp ( ) const
inherited

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

Definition at line 959 of file TString.cxx.

◆ MaybeWildcard()

Bool_t TString::MaybeWildcard ( ) const
inherited

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

Definition at line 971 of file TString.cxx.

◆ MD5()

TString TString::MD5 ( ) const
inherited

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

Definition at line 947 of file TString.cxx.

◆ operator const char *()

TString::operator const char * ( ) const
inlineinherited

Definition at line 318 of file TString.h.

◆ operator()() [1/7]

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

Return the substring found by applying the regexp.

Definition at line 286 of file TRegexp.cxx.

◆ operator()() [2/7]

TSubString TString::operator() ( const TRegexp & r,
Ssiz_t start ) const
inherited

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

Please, see the Warning in the class documentation above.

Definition at line 276 of file TRegexp.cxx.

◆ operator()() [3/7]

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

Definition at line 733 of file TString.h.

◆ operator()() [4/7]

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

Definition at line 736 of file TString.h.

◆ operator()() [5/7]

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

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

Definition at line 1645 of file TString.cxx.

◆ operator()() [6/7]

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

Return the substring found by applying the regexp.

Definition at line 653 of file TPRegexp.cxx.

◆ operator()() [7/7]

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

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

Definition at line 643 of file TPRegexp.cxx.

◆ operator+=() [1/6]

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

Definition at line 599 of file TString.h.

◆ operator+=() [2/6]

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

Definition at line 593 of file TString.h.

◆ operator+=() [3/6]

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

Definition at line 596 of file TString.h.

◆ operator+=() [4/6]

template<class T>
std::enable_if< ROOT::TypeTraits::IsFloatNumeral< T >::value, TString >::type & TString::operator+= ( T f)
inherited

◆ operator+=() [5/6]

template<class T>
std::enable_if< ROOT::TypeTraits::IsFloatNumeral< T >::value, TString >::type & TString::operator+= ( T i)
inlineinherited

Definition at line 604 of file TString.h.

◆ operator+=() [6/6]

template<class T>
std::enable_if< ROOT::TypeTraits::IsUnsignedNumeral< T >::value, TString >::type & TString::operator+= ( T u)
inherited

◆ operator[]() [1/2]

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

Definition at line 739 of file TString.h.

◆ operator[]() [2/2]

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

Definition at line 742 of file TString.h.

◆ Prepend() [1/5]

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

Prepend character c rep times to string.

Warning
If length+rep exceeds MaxSize(), then Fatal() is raised and only MaxSize()-length elements are added

Definition at line 984 of file TString.cxx.

◆ Prepend() [2/5]

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

Definition at line 682 of file TString.h.

◆ Prepend() [3/5]

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

Definition at line 685 of file TString.h.

◆ Prepend() [4/5]

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

Definition at line 688 of file TString.h.

◆ Prepend() [5/5]

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

Definition at line 691 of file TString.h.

◆ Puts()

void TString::Puts ( FILE * fp)
inherited

Write string to the stream.

Definition at line 229 of file Stringio.cxx.

◆ ReadBuffer()

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

Read string from I/O buffer.

Definition at line 1337 of file TString.cxx.

◆ ReadFile()

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

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

Definition at line 29 of file Stringio.cxx.

◆ ReadLine()

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

Read a line from stream upto newline skipping any whitespace.

Definition at line 71 of file Stringio.cxx.

◆ ReadString() [1/2]

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

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

Definition at line 82 of file Stringio.cxx.

◆ ReadString() [2/2]

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

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 1368 of file TString.cxx.

◆ ReadToDelim()

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

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 95 of file Stringio.cxx.

◆ ReadToken()

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

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

Definition at line 133 of file Stringio.cxx.

◆ Recommend()

Ssiz_t TString::Recommend ( Ssiz_t s)
inlinestaticprotectedinherited

Definition at line 234 of file TString.h.

◆ Remove() [1/3]

TString & TString::Remove ( EStripType s,
char c )
inherited

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

Definition at line 1131 of file TString.cxx.

◆ Remove() [2/3]

TString & TString::Remove ( Ssiz_t pos)
inlineinherited

Definition at line 694 of file TString.h.

◆ Remove() [3/3]

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

Definition at line 697 of file TString.h.

◆ Replace() [1/4]

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

Definition at line 703 of file TString.h.

◆ Replace() [2/4]

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

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

Definition at line 1026 of file TString.cxx.

◆ Replace() [3/4]

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

Definition at line 706 of file TString.h.

◆ Replace() [4/4]

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

Definition at line 709 of file TString.h.

◆ ReplaceAll() [1/5]

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

Definition at line 722 of file TString.h.

◆ ReplaceAll() [2/5]

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

Definition at line 719 of file TString.h.

◆ ReplaceAll() [3/5]

TString & TString::ReplaceAll ( const char * s1,
Ssiz_t ls1,
const char * s2,
Ssiz_t ls2 )
inherited

Find & Replace ls1 symbols of s1 with ls2 symbols of s2 if any.

Definition at line 1102 of file TString.cxx.

◆ ReplaceAll() [4/5]

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

Definition at line 716 of file TString.h.

◆ ReplaceAll() [5/5]

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

Definition at line 713 of file TString.h.

◆ ReplaceSpecialCppChars()

TString & TString::ReplaceSpecialCppChars ( )
inherited

Find special characters which are typically used in printf() calls and replace them by appropriate escape sequences.

Result can be stored as string argument in ROOT macros. The content of TString will be changed!

Definition at line 1121 of file TString.cxx.

◆ Resize()

void TString::Resize ( Ssiz_t n)
inherited

Resize the string. Truncate or add blanks as necessary.

Definition at line 1159 of file TString.cxx.

◆ ResizeIncrement()

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

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

Definition at line 1608 of file TString.cxx.

◆ SetLongCap()

void TString::SetLongCap ( Ssiz_t s)
inlineprivateinherited

Definition at line 257 of file TString.h.

◆ SetLongPointer()

void TString::SetLongPointer ( char * p)
inlineprivateinherited

Definition at line 259 of file TString.h.

◆ SetLongSize()

void TString::SetLongSize ( Ssiz_t s)
inlineprivateinherited

Definition at line 254 of file TString.h.

◆ SetShortSize()

void TString::SetShortSize ( Ssiz_t s)
inlineprivateinherited

Definition at line 251 of file TString.h.

◆ SetSize()

void TString::SetSize ( Ssiz_t s)
inlineprivateinherited

Definition at line 256 of file TString.h.

◆ SetString()

virtual void TGString::SetString ( const char * s)
inlinevirtual

Definition at line 31 of file TGString.h.

◆ size()

std::size_t TString::size ( ) const
inlineinherited

Definition at line 426 of file TString.h.

◆ Sizeof()

Int_t TString::Sizeof ( ) const
virtualinherited

Returns size string will occupy on I/O buffer.

Definition at line 1407 of file TString.cxx.

◆ Streamer()

void TGString::Streamer ( TBuffer & b)
overridevirtual

Stream a string object.

Reimplemented from TString.

◆ StreamerNVirtual()

void TGString::StreamerNVirtual ( TBuffer & ClassDef_StreamerNVirtual_b)
inline

Definition at line 38 of file TGString.h.

◆ Strip()

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

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

Definition at line 1170 of file TString.cxx.

◆ SubString()

TSubString TString::SubString ( const char * pattern,
Ssiz_t startIndex = 0,
ECaseCompare cmp = kExact ) const
inherited

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 1663 of file TString.cxx.

◆ Swap()

TString & TString::Swap ( TString & other)
inlineinherited

Definition at line 725 of file TString.h.

◆ Tokenize() [1/2]

TObjArray * TString::Tokenize ( const TString & delim) const
inherited

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 2270 of file TString.cxx.

◆ Tokenize() [2/2]

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

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
...
}
int Ssiz_t
String size (currently int).
Definition RtypesCore.h:81
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
Definition TString.cxx:2270

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

Definition at line 310 of file TRegexp.cxx.

◆ ToLower()

void TString::ToLower ( )
inherited

Change string to lower-case.

Definition at line 1189 of file TString.cxx.

◆ ToUpper()

void TString::ToUpper ( )
inherited

Change string to upper case.

Definition at line 1202 of file TString.cxx.

◆ UItoa()

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

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 2125 of file TString.cxx.

◆ ULLtoa()

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

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 2177 of file TString.cxx.

◆ UnLink()

void TString::UnLink ( ) const
inlineprivateinherited

Definition at line 271 of file TString.h.

◆ View()

std::string_view TString::View ( ) const
inlineinherited

Definition at line 461 of file TString.h.

◆ WriteString()

void TString::WriteString ( TBuffer & b,
const TString * a )
staticinherited

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 1434 of file TString.cxx.

◆ Zero()

void TString::Zero ( )
inlineprivateinherited

Definition at line 272 of file TString.h.

Member Data Documentation

◆ fRep

Rep_t TString::fRep
protectedinherited

! String data

Definition at line 223 of file TString.h.

◆ kNPOS

Ssiz_t TString::kNPOS = ::kNPOS
staticconstexprinherited

Definition at line 286 of file TString.h.


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