111 operator std::string()
const {
return std::string(
Data(),
fExtent); }
113 const char *
Data()
const;
144friend typename std::enable_if<ROOT::TypeTraits::IsSignedNumeral<T>::value,
TString>
::type
147friend typename std::enable_if<ROOT::TypeTraits::IsUnsignedNumeral<T>::value,
TString>
::type
150friend typename std::enable_if<ROOT::TypeTraits::IsFloatNumeral<T>::value,
TString>
::type
153friend typename std::enable_if<ROOT::TypeTraits::IsSignedNumeral<T>::value,
TString>
::type
156friend typename std::enable_if<ROOT::TypeTraits::IsUnsignedNumeral<T>::value,
TString>
::type
159friend typename std::enable_if<ROOT::TypeTraits::IsFloatNumeral<T>::value,
TString>
::type
179 enum { kMinCap = (
sizeof(
LongStr_t) - 1)/
sizeof(char) > 2 ?
180 (
sizeof(
LongStr_t) - 1)/
sizeof(
char) : 2 };
257 void FormImp(
const char *fmt, va_list ap);
296#if (__cplusplus >= 201700L) && (!defined(__clang_major__) || __clang_major__ > 5)
299 explicit operator std::string()
const {
return std::string(
GetPointer(),
Length()); }
319 typename std::enable_if<ROOT::TypeTraits::IsSignedNumeral<T>::value,
TString>
::type
322 typename std::enable_if<ROOT::TypeTraits::IsUnsignedNumeral<T>::value,
TString>
::type
325 typename std::enable_if<ROOT::TypeTraits::IsFloatNumeral<T>::value,
TString>
::type
370 void Form(
const char *fmt, ...)
371#if defined(__GNUC__) && !defined(__CINT__)
372 __attribute__((format(printf, 2, 3)))
414 std::istream &
ReadFile(std::istream &str);
415 std::istream &
ReadLine(std::istream &str,
418 std::istream &
ReadToDelim(std::istream &str,
char delim =
'\n');
419 std::istream &
ReadToken(std::istream &str);
455#if defined(__GNUC__) && !defined(__CINT__)
456 __attribute__((format(printf, 1, 2)))
466#if defined(R__TEMPLATE_OVERLOAD_BUG)
475 return left.append(right.
Data());
485extern char *
Form(
const char *fmt, ...)
486#if defined(__GNUC__) && !defined(__CINT__)
487__attribute__((format(printf, 1, 2)))
491#if defined(__GNUC__) && !defined(__CINT__)
492__attribute__((format(printf, 1, 2)))
495extern char *
Strip(
const char *str,
char c =
' ');
496extern char *
StrDup(
const char *str);
497extern char *
Compress(
const char *str);
498extern int EscChar(
const char *src,
char *dst,
int dstlen,
char *specchars,
500extern int UnEscChar(
const char *src,
char *dst,
int dstlen,
char *specchars,
503#ifdef NEED_STRCASECMP
504extern int strcasecmp(
const char *str1,
const char *str2);
505extern int strncasecmp(
const char *str1,
const char *str2,
Ssiz_t n);
515inline typename std::enable_if<ROOT::TypeTraits::IsSignedNumeral<T>::value,
TString>
::type
520inline typename std::enable_if<ROOT::TypeTraits::IsUnsignedNumeral<T>::value,
TString>
::type
525inline typename std::enable_if<ROOT::TypeTraits::IsFloatNumeral<T>::value,
TString>
::type
530inline typename std::enable_if<ROOT::TypeTraits::IsSignedNumeral<T>::value,
TString>
::type
536 return TString(buffer, strlen(buffer),
s.Data(),
s.Length());
540inline typename std::enable_if<ROOT::TypeTraits::IsUnsignedNumeral<T>::value,
TString>
::type
546 return TString(buffer, strlen(buffer),
s.Data(),
s.Length());
550inline typename std::enable_if<ROOT::TypeTraits::IsFloatNumeral<T>::value,
TString>
::type
556 return TString(buffer, strlen(buffer),
s.Data(),
s.Length());
572{
return Append(cs, cs ? strlen(cs) : 0); }
575{
return Append(
s.Data(),
s.Length()); }
581inline typename std::enable_if<ROOT::TypeTraits::IsSignedNumeral<T>::value,
TString>
::type
591inline typename std::enable_if<ROOT::TypeTraits::IsUnsignedNumeral<T>::value,
TString>
::type
601inline typename std::enable_if<ROOT::TypeTraits::IsFloatNumeral<T>::value,
TString>
::type
635{
return Index(
s,
s ? strlen(
s) : 0, i, cmp); }
638{
return Index(
s.Data(),
s.Length(), i, cmp); }
642{
return Index(pat.
Data(), patlen, i, cmp); }
645{
return Replace(pos, 0, cs, cs ? strlen(cs) : 0); }
651{
return Replace(pos, 0,
s.Data(),
s.Length()); }
657{
return Replace(0, 0, cs, cs ? strlen(cs) : 0); }
663{
return Replace(0, 0,
s.Data(),
s.Length()); }
678{
return Replace(pos,
n, cs, cs ? strlen(cs) : 0); }
681{
return Replace(pos,
n,
s.Data(),
s.Length()); }
691{
return ReplaceAll(
s1.Data(),
s1.Length(), s2, s2 ? strlen(s2) : 0); }
754 return ((
s1.Length() == s2.
Length()) &&
755 !memcmp(
s1.Data(), s2.
Data(),
s1.Length()));
759{
return !(
s1 == s2); }
762{
return s1.CompareTo(s2) < 0; }
765{
return s1.CompareTo(s2) > 0; }
768{
return s1.CompareTo(s2) <= 0; }
771{
return s1.CompareTo(s2) >= 0; }
775{
return !(
s1 == s2); }
778{
return s1.CompareTo(s2) < 0; }
781{
return s1.CompareTo(s2) > 0; }
784{
return s1.CompareTo(s2) <= 0; }
787{
return s1.CompareTo(s2) >= 0; }
790{
return (s2 ==
s1); }
793{
return !(s2 ==
s1); }
812{
return (s2 ==
s1); }
815{
return (s2 ==
s1); }
818{
return !(
s1 == s2); }
821{
return !(
s1 == s2); }
824{
return !(
s1 == s2); }
827{
return !(s2 ==
s1); }
830{
return !(s2 ==
s1); }
850 std::string printValue(
const TString* val);
851 std::string printValue(
const TSubString* val);
unsigned long long ULong64_t
#define ClassDef(name, id)
TString ToUpper(const TString &s)
Return an upper-case version of str.
Bool_t operator!=(const TString &s1, const TString &s2)
TString ToLower(const TString &s)
Return a lower-case version of str.
std::ostream & operator<<(std::ostream &str, const TString &s)
Write string to stream.
Bool_t operator>(const TString &s1, const TString &s2)
Bool_t operator>=(const TString &s1, const TString &s2)
char * Compress(const char *str)
Remove all blanks from the string str.
char * Form(const char *fmt,...)
UInt_t Hash(const TString &s)
int UnEscChar(const char *src, char *dst, int dstlen, char *specchars, char escchar)
Un-escape specchars in src from escchar and copy to dst.
Bool_t operator<(const TString &s1, const TString &s2)
TString operator+(const TString &s1, const TString &s2)
Use the special concatenation constructor.
char * Strip(const char *str, char c=' ')
Strip leading and trailing c (blanks by default) from a string.
Bool_t operator<=(const TString &s1, const TString &s2)
void Printf(const char *fmt,...)
Bool_t operator==(const TString &s1, const TString &s2)
char * StrDup(const char *str)
Duplicate 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.
std::istream & operator>>(std::istream &str, TString &s)
Read string from stream.
std::string & operator+=(std::string &left, const TString &right)
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket.
Buffer base class used for serializing objects.
TClass instances represent classes, structs and namespaces in the ROOT type system.
Regular expression class.
ATTENTION: this class is obsolete.
TString Copy() const
Copy a string.
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...
const char * GetPointer() const
char & operator[](Ssiz_t i)
static TString LLtoa(Long64_t value, Int_t base)
Converts a Long64_t to a TString with respect to the base specified (2-36).
std::enable_if< ROOT::TypeTraits::IsFloatNumeral< T >::value, TString >::type & operator+=(T f)
void SetShortSize(Ssiz_t s)
char & operator()(Ssiz_t i)
Bool_t IsDec() const
Returns true if all characters in string are decimal digits (0-9).
void ToLower()
Change string to lower-case.
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
TString & Insert(Ssiz_t pos, const char *s)
static Ssiz_t MaxWaste(Ssiz_t mw=15)
Set maximum space that may be wasted in a string before doing a resize.
Int_t Atoi() const
Return integer value of string.
static Ssiz_t Align(Ssiz_t s)
void SetLongSize(Ssiz_t s)
Bool_t Gets(FILE *fp, Bool_t chop=kTRUE)
Read one line from the stream, including the , or until EOF.
std::istream & ReadToDelim(std::istream &str, char delim='\n')
Read up to an EOF, or a delimiting character, whichever comes first.
static const Ssiz_t kNPOS
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
TSubString Strip(EStripType s=kTrailing, char c=' ') const
Return a substring of self stripped at beginning and/or end.
TString()
TString default ctor.
Bool_t IsHex() const
Returns true if all characters in string are hexadecimal digits (0-9,a-f,A-F).
Double_t Atof() const
Return floating-point value contained in string.
Bool_t IsFloat() const
Returns kTRUE if string contains a floating point or integer number.
void Clear()
Clear string without changing its capacity.
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.
TString & Replace(Ssiz_t pos, Ssiz_t n, const char *s)
Ssiz_t First(char c) const
Find first occurrence of a character c.
const char * Data() const
static TString * ReadString(TBuffer &b, const TClass *clReq)
Read TString object from buffer.
Bool_t EqualTo(const char *cs, ECaseCompare cmp=kExact) const
Bool_t IsDigit() const
Returns true if all characters in string are digits (0-9) or white spaces, i.e.
Bool_t MaybeRegexp() const
Returns true if string contains one of the regexp characters "^$.[]*+?".
static Ssiz_t ResizeIncrement(Ssiz_t ri=16)
Set default resize increment for all TStrings. Default is 16.
UInt_t HashCase() const
Return a case-sensitive hash value (endian independent).
Bool_t IsOct() const
Returns true if all characters in string are octal digits (0-7).
virtual ~TString()
Delete a TString.
static Ssiz_t GetMaxWaste()
TString & ReplaceAll(const TString &s1, const TString &s2)
static Ssiz_t AdjustCapacity(Ssiz_t oldCap, Ssiz_t newCap)
Calculate a nice capacity greater than or equal to newCap.
TString MD5() const
Return the MD5 digest for this string, in a string representation.
void Resize(Ssiz_t n)
Resize the string. Truncate or add blanks as necessary.
Bool_t IsAlpha() const
Returns true if all characters in string are alphabetic.
UInt_t HashFoldCase() const
Return a case-insensitive hash value (endian independent).
Ssiz_t Last(char c) const
Find last occurrence of a character c.
void ToUpper()
Change string to upper case.
Bool_t IsAscii() const
Returns true if all characters in string are ascii.
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
static Ssiz_t GetResizeIncrement()
void Puts(FILE *fp)
Write string to the stream.
void SetLongCap(Ssiz_t s)
friend TString operator+(const TString &s1, const TString &s2)
Use the special concatenation constructor.
std::string_view View() const
TString & Prepend(const char *cs)
TString & Swap(TString &other)
Bool_t IsBin() const
Returns true if all characters in string are binary digits (0,1).
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 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...
Int_t CountChar(Int_t c) const
Return number of times character c occurs in the string.
friend Bool_t operator==(const TString &s1, const TString &s2)
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.
static void WriteString(TBuffer &b, const TString *a)
Write TString object to buffer.
virtual void FillBuffer(char *&buffer) const
Copy string into I/O buffer.
TString & operator=(char s)
Assign character c to TString.
std::istream & ReadFile(std::istream &str)
Replace string with the contents of strm, stopping at an EOF.
TString & Remove(Ssiz_t pos)
static Ssiz_t InitialCapacity(Ssiz_t ic=15)
Set default initial capacity for all TStrings. Default is 15.
TString & Append(const char *cs)
Bool_t IsInBaseN(Int_t base) const
Returns true if all characters in string are expressed in the base specified (range=2-36),...
char * Init(Ssiz_t capacity, Ssiz_t nchar)
Private member function returning an empty string representation of size capacity and containing ncha...
Bool_t MaybeWildcard() const
Returns true if string contains one of the wildcard characters "[]*?".
void InitChar(char c)
Initialize a string with a single character.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
static TString Itoa(Int_t value, Int_t base)
Converts an Int_t to a TString with respect to the base specified (2-36).
virtual Int_t Sizeof() const
Returns size string will occupy on I/O buffer.
TString & operator+=(const char *s)
Ssiz_t GetShortSize() const
Bool_t IsWhitespace() const
void Clone(Ssiz_t nc)
Make self a distinct copy with capacity of at least tot, where tot cannot be smaller than the current...
const char * GetLongPointer() const
std::enable_if< ROOT::TypeTraits::IsUnsignedNumeral< T >::value, TString >::type & operator+=(T u)
const char * GetShortPointer() const
Ssiz_t GetLongCap() const
void SetLongPointer(char *p)
std::istream & ReadToken(std::istream &str)
Read a token, delimited by whitespace, from the input stream.
Ssiz_t GetLongSize() const
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
friend TBuffer & operator<<(TBuffer &b, const TString *obj)
Write TString or derived to TBuffer.
static Ssiz_t GetInitialCapacity()
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
void AssertElement(Ssiz_t nc) const
Check to make sure a string index is in range.
virtual void ReadBuffer(char *&buffer)
Read string from I/O buffer.
Bool_t IsAlnum() const
Returns true if all characters in string are alphanumeric.
void FormImp(const char *fmt, va_list ap)
Formats a string using a printf style format descriptor.
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
void Clobber(Ssiz_t nc)
Clear string and make sure it has a capacity of nc.
static Ssiz_t Recommend(Ssiz_t s)
std::istream & ReadLine(std::istream &str, Bool_t skipWhite=kTRUE)
Read a line from stream upto newline skipping any whitespace.
Long64_t Atoll() const
Return long long value of string.
A zero length substring is legal.
TSubString(const TString &s, Ssiz_t start, Ssiz_t len)
Private constructor.
TSubString & operator=(const char *s)
Assign char* to sub-string.
void ToUpper()
Convert sub-string to upper-case.
void SubStringError(Ssiz_t, Ssiz_t, Ssiz_t) const
Output error message.
char & operator[](Ssiz_t i)
Return character at pos i from sub-string. Check validity of i.
friend Bool_t operator==(const TSubString &s1, const TSubString &s2)
Compare two sub-strings.
void AssertElement(Ssiz_t i) const
Check to make sure a sub-string index is in range.
void ToLower()
Convert sub-string to lower-case.
TSubString(const TSubString &s)
const char * Data() const
char & operator()(Ssiz_t i)
Return character at pos i from sub-string. No check on i.
This class implements a mutex interface.
basic_string_view< char > string_view
static constexpr double s
static constexpr double ns
Short_t Max(Short_t a, Short_t b)
Short_t Min(Short_t a, Short_t b)