Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TString.h File Reference
#include "Rtypes.h"
#include <string_view>
#include "ROOT/TypeTraits.hxx"
#include "snprintf.h"
#include <iosfwd>
#include <cstdarg>
#include <cstdio>
#include <cstring>
#include <string>
Include dependency graph for TString.h:

Classes

struct  TString::LongStr_t
 
struct  TString::RawStr_t
 
struct  TString::Rep_t
 
struct  TString::ShortStr_t
 
class  TString
 Basic string class. More...
 
class  TSubString
 A zero length substring is legal. More...
 
union  TString::UStr_t
 

Namespaces

namespace  llvm
 

Functions

char * Compress (const char *str)
 Remove all blanks from the string str.
 
int EscChar (const char *src, char *dst, int dstlen, char *specchars, char escchar)
 Escape specchars in src with escchar and copy to dst.
 
char * Form (const char *fmt,...)
 Formats a string in a circular formatting buffer.
 
UInt_t Hash (const char *s)
 Return a case-sensitive hash value (endian independent).
 
UInt_t Hash (const TString &s)
 
UInt_t Hash (const TString *s)
 
Bool_t operator!= (const char *s1, const TString &s2)
 
Bool_t operator!= (const char *s1, const TSubString &s2)
 
Bool_t operator!= (const TString &s1, const char *s2)
 
Bool_t operator!= (const TString &s1, const TString &s2)
 
Bool_t operator!= (const TString &s1, const TSubString &s2)
 
Bool_t operator!= (const TSubString &s1, const char *s2)
 
Bool_t operator!= (const TSubString &s1, const TString &s2)
 
Bool_t operator!= (const TSubString &s1, const TSubString &s2)
 
TString operator+ (char c, const TString &s)
 Add string to char.
 
TString operator+ (const char *cs, const TString &s)
 Use the special concatenation constructor.
 
TString operator+ (const TString &s, char c)
 Add char to string.
 
TString operator+ (const TString &s, const char *cs)
 Use the special concatenation constructor.
 
TString operator+ (const TString &s1, const TString &s2)
 Use the special concatenation constructor.
 
template<class T >
std::enable_if< ROOT::TypeTraits::IsFloatNumeral< T >::value, TString >::type operator+ (T f, const TString &s)
 
template<class T >
std::enable_if< ROOT::TypeTraits::IsSignedNumeral< T >::value, TString >::type operator+ (T i, const TString &s)
 
template<class T >
std::enable_if< ROOT::TypeTraits::IsUnsignedNumeral< T >::value, TString >::type operator+ (T u, const TString &s)
 
template<class T >
std::enable_if< ROOT::TypeTraits::IsFloatNumeral< T >::value, TString >::type operator+ (TString s, T f)
 
template<class T >
std::enable_if< ROOT::TypeTraits::IsSignedNumeral< T >::value, TString >::type operator+ (TString s, T i)
 
template<class T >
std::enable_if< ROOT::TypeTraits::IsUnsignedNumeral< T >::value, TString >::type operator+ (TString s, T u)
 
std::string & operator+= (std::string &left, const TString &right)
 
Bool_t operator< (const char *s1, const TString &s2)
 
Bool_t operator< (const TString &s1, const char *s2)
 
Bool_t operator< (const TString &s1, const TString &s2)
 
std::ostream & operator<< (std::ostream &str, const TString &s)
 Write string to stream.
 
TBufferoperator<< (TBuffer &buf, const TString *sp)
 Write TString or derived to TBuffer.
 
Bool_t operator<= (const char *s1, const TString &s2)
 
Bool_t operator<= (const TString &s1, const char *s2)
 
Bool_t operator<= (const TString &s1, const TString &s2)
 
Bool_t operator== (const char *s1, const TString &s2)
 
Bool_t operator== (const char *s1, const TSubString &s2)
 
Bool_t operator== (const TString &s1, const char *s2)
 Compare TString with a char *.
 
Bool_t operator== (const TString &s1, const TString &s2)
 
Bool_t operator== (const TString &s1, const TSubString &s2)
 
Bool_t operator== (const TSubString &s1, const char *s2)
 Compare sub-string to char *.
 
Bool_t operator== (const TSubString &s1, const TString &s2)
 Compare sub-string to string.
 
Bool_t operator== (const TSubString &s1, const TSubString &s2)
 Compare two sub-strings.
 
Bool_t operator> (const char *s1, const TString &s2)
 
Bool_t operator> (const TString &s1, const char *s2)
 
Bool_t operator> (const TString &s1, const TString &s2)
 
Bool_t operator>= (const char *s1, const TString &s2)
 
Bool_t operator>= (const TString &s1, const char *s2)
 
Bool_t operator>= (const TString &s1, const TString &s2)
 
std::istream & operator>> (std::istream &str, TString &s)
 Read string from stream.
 
TBufferoperator>> (TBuffer &buf, TString *&sp)
 Read string from TBuffer. Function declared in ClassDef.
 
void Printf (const char *fmt,...)
 Formats a string in a circular formatting buffer and prints the string.
 
char * StrDup (const char *str)
 Duplicate the string str.
 
char * Strip (const char *str, char c=' ')
 Strip leading and trailing c (blanks by default) from a string.
 
TString ToLower (const TString &s)
 Return a lower-case version of str.
 
TString ToUpper (const TString &s)
 Return an upper-case version of str.
 
int UnEscChar (const char *src, char *dst, int dstlen, char *specchars, char escchar)
 Un-escape specchars in src from escchar and copy to dst.
 

Function Documentation

◆ Compress()

char * Compress ( const char * str)
extern

Remove all blanks from the string str.

The returned string has to be deleted by the user.

Definition at line 2653 of file TString.cxx.

◆ EscChar()

int EscChar ( const char * src,
char * dst,
int dstlen,
char * specchars,
char escchar )
extern

Escape specchars in src with escchar and copy to dst.

Definition at line 2674 of file TString.cxx.

◆ Form()

char * Form ( const char * fmt,
... )
extern

Formats a string in a circular formatting buffer.

Removes the need to create and delete short lived strings. Don't pass Form() pointers from user code down to ROOT functions as the circular buffer may be overwritten downstream. Use Form() results immediately or use TString::Format() instead.

Definition at line 2570 of file TString.cxx.

◆ Hash() [1/3]

UInt_t Hash ( const char * s)

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

Definition at line 583 of file TString.cxx.

◆ Hash() [2/3]

UInt_t Hash ( const TString & s)
inline

Definition at line 505 of file TString.h.

◆ Hash() [3/3]

UInt_t Hash ( const TString * s)
inline

Definition at line 506 of file TString.h.

◆ operator!=() [1/8]

Bool_t operator!= ( const char * s1,
const TString & s2 )
inline

Definition at line 818 of file TString.h.

◆ operator!=() [2/8]

Bool_t operator!= ( const char * s1,
const TSubString & s2 )
inline

Definition at line 855 of file TString.h.

◆ operator!=() [3/8]

Bool_t operator!= ( const TString & s1,
const char * s2 )
inline

Definition at line 800 of file TString.h.

◆ operator!=() [4/8]

Bool_t operator!= ( const TString & s1,
const TString & s2 )
inline

Definition at line 784 of file TString.h.

◆ operator!=() [5/8]

Bool_t operator!= ( const TString & s1,
const TSubString & s2 )
inline

Definition at line 852 of file TString.h.

◆ operator!=() [6/8]

Bool_t operator!= ( const TSubString & s1,
const char * s2 )
inline

Definition at line 843 of file TString.h.

◆ operator!=() [7/8]

Bool_t operator!= ( const TSubString & s1,
const TString & s2 )
inline

Definition at line 846 of file TString.h.

◆ operator!=() [8/8]

Bool_t operator!= ( const TSubString & s1,
const TSubString & s2 )
inline

Definition at line 849 of file TString.h.

◆ operator+() [1/11]

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

Add string to char.

Definition at line 1637 of file TString.cxx.

◆ operator+() [2/11]

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

Use the special concatenation constructor.

Definition at line 1613 of file TString.cxx.

◆ operator+() [3/11]

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

Add char to string.

Definition at line 1629 of file TString.cxx.

◆ operator+() [4/11]

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

Use the special concatenation constructor.

Definition at line 1605 of file TString.cxx.

◆ operator+() [5/11]

Use the special concatenation constructor.

Definition at line 1621 of file TString.cxx.

◆ operator+() [6/11]

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

Definition at line 575 of file TString.h.

◆ operator+() [7/11]

Definition at line 555 of file TString.h.

◆ operator+() [8/11]

Definition at line 565 of file TString.h.

◆ operator+() [9/11]

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

Definition at line 550 of file TString.h.

◆ operator+() [10/11]

Definition at line 540 of file TString.h.

◆ operator+() [11/11]

Definition at line 545 of file TString.h.

◆ operator+=()

std::string & operator+= ( std::string & left,
const TString & right )
inline

Definition at line 497 of file TString.h.

◆ operator<() [1/3]

Bool_t operator< ( const char * s1,
const TString & s2 )
inline

Definition at line 821 of file TString.h.

◆ operator<() [2/3]

Bool_t operator< ( const TString & s1,
const char * s2 )
inline

Definition at line 803 of file TString.h.

◆ operator<() [3/3]

Bool_t operator< ( const TString & s1,
const TString & s2 )
inline

Definition at line 787 of file TString.h.

◆ operator<<() [1/2]

std::ostream & operator<< ( std::ostream & str,
const TString & s )

Write string to stream.

Definition at line 177 of file Stringio.cxx.

◆ operator<<() [2/2]

TBuffer & operator<< ( TBuffer & buf,
const TString * sp )

Write TString or derived to TBuffer.

Definition at line 1550 of file TString.cxx.

◆ operator<=() [1/3]

Bool_t operator<= ( const char * s1,
const TString & s2 )
inline

Definition at line 827 of file TString.h.

◆ operator<=() [2/3]

Bool_t operator<= ( const TString & s1,
const char * s2 )
inline

Definition at line 809 of file TString.h.

◆ operator<=() [3/3]

Bool_t operator<= ( const TString & s1,
const TString & s2 )
inline

Definition at line 793 of file TString.h.

◆ operator==() [1/8]

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

Definition at line 815 of file TString.h.

◆ operator==() [2/8]

Bool_t operator== ( const char * s1,
const TSubString & s2 )
inline

Definition at line 840 of file TString.h.

◆ operator==() [3/8]

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

Compare TString with a char *.

Definition at line 1562 of file TString.cxx.

◆ operator==() [4/8]

Bool_t operator== ( const TString & s1,
const TString & s2 )
inline

Definition at line 778 of file TString.h.

◆ operator==() [5/8]

Bool_t operator== ( const TString & s1,
const TSubString & s2 )
inline

Definition at line 837 of file TString.h.

◆ operator==() [6/8]

Bool_t operator== ( const TSubString & s1,
const char * s2 )

Compare sub-string to char *.

Definition at line 1787 of file TString.cxx.

◆ operator==() [7/8]

Compare sub-string to string.

Definition at line 1801 of file TString.cxx.

◆ operator==() [8/8]

Compare two sub-strings.

Definition at line 1811 of file TString.cxx.

◆ operator>() [1/3]

Bool_t operator> ( const char * s1,
const TString & s2 )
inline

Definition at line 824 of file TString.h.

◆ operator>() [2/3]

Bool_t operator> ( const TString & s1,
const char * s2 )
inline

Definition at line 806 of file TString.h.

◆ operator>() [3/3]

Bool_t operator> ( const TString & s1,
const TString & s2 )
inline

Definition at line 790 of file TString.h.

◆ operator>=() [1/3]

Bool_t operator>= ( const char * s1,
const TString & s2 )
inline

Definition at line 830 of file TString.h.

◆ operator>=() [2/3]

Bool_t operator>= ( const TString & s1,
const char * s2 )
inline

Definition at line 812 of file TString.h.

◆ operator>=() [3/3]

Bool_t operator>= ( const TString & s1,
const TString & s2 )
inline

Definition at line 796 of file TString.h.

◆ operator>>() [1/2]

std::istream & operator>> ( std::istream & str,
TString & s )

Read string from stream.

Definition at line 169 of file Stringio.cxx.

◆ operator>>() [2/2]

TBuffer & operator>> ( TBuffer & buf,
TString *& sp )

Read string from TBuffer. Function declared in ClassDef.

Definition at line 1541 of file TString.cxx.

◆ Printf()

void Printf ( const char * fmt,
... )
extern

Formats a string in a circular formatting buffer and prints the string.

Appends a newline. If gPrintViaErrorHandler is true it will print via the currently active ROOT error handler.

Definition at line 2584 of file TString.cxx.

◆ StrDup()

char * StrDup ( const char * str)
extern

Duplicate the string str.

The returned string has to be deleted by the user.

Definition at line 2638 of file TString.cxx.

◆ Strip()

char * Strip ( const char * s,
char c )
extern

Strip leading and trailing c (blanks by default) from a string.

The returned string has to be deleted by the user.

Definition at line 2602 of file TString.cxx.

◆ ToLower()

TString ToLower ( const TString & s)

Return a lower-case version of str.

Definition at line 1577 of file TString.cxx.

◆ ToUpper()

TString ToUpper ( const TString & s)

Return an upper-case version of str.

Definition at line 1591 of file TString.cxx.

◆ UnEscChar()

int UnEscChar ( const char * src,
char * dst,
int dstlen,
char * specchars,
char escchar )
extern

Un-escape specchars in src from escchar and copy to dst.

Definition at line 2698 of file TString.cxx.