105 operator std::string()
const {
return std::string(
Data(),
fExtent); }
107 const char *
Data()
const;
161 enum { kMinCap = (
sizeof(
LongStr_t) - 1)/
sizeof(char) > 2 ?
162 (
sizeof(
LongStr_t) - 1)/
sizeof(
char) : 2 };
239 void FormImp(
const char *fmt, va_list ap);
278 #if (__cplusplus >= 201700L) && (!defined(__clang_major__) || __clang_major__ > 5) 281 explicit operator std::string()
const {
return std::string(
GetPointer(),
Length()); }
351 void Form(
const char *fmt, ...)
352 #if defined(__GNUC__) && !defined(__CINT__) 353 __attribute__((format(printf, 2, 3)))
395 std::istream &
ReadFile(std::istream &str);
396 std::istream &
ReadLine(std::istream &str,
399 std::istream &
ReadToDelim(std::istream &str,
char delim =
'\n');
400 std::istream &
ReadToken(std::istream &str);
436 #if defined(__GNUC__) && !defined(__CINT__) 437 __attribute__((format(printf, 1, 2)))
447 #if defined(R__TEMPLATE_OVERLOAD_BUG) 456 return left.append(right.
Data());
466 extern char *
Form(
const char *fmt, ...)
467 #if defined(__GNUC__) && !defined(__CINT__) 468 __attribute__((format(printf, 1, 2)))
471 extern void Printf(
const char *fmt, ...)
472 #if defined(__GNUC__) && !defined(__CINT__) 473 __attribute__((format(printf, 1, 2)))
476 extern char *
Strip(
const char *str,
char c =
' ');
477 extern char *
StrDup(
const char *str);
478 extern char *
Compress(
const char *str);
479 extern int EscChar(
const char *src,
char *dst,
int dstlen,
char *specchars,
481 extern int UnEscChar(
const char *src,
char *dst,
int dstlen,
char *specchars,
484 #ifdef NEED_STRCASECMP 485 extern int strcasecmp(
const char *str1,
const char *str2);
486 extern int strncasecmp(
const char *str1,
const char *str2,
Ssiz_t n);
508 {
return Append(cs, cs ? strlen(cs) : 0); }
511 {
return Append(
s.Data(),
s.Length()); }
538 sprintf(
s,
"%.17g", f);
549 sprintf(
s,
"%lld",
l);
557 sprintf(
s,
"%llu", ul);
586 {
return Index(
s,
s ? strlen(
s) : 0, i, cmp); }
589 {
return Index(
s.Data(),
s.Length(), i, cmp); }
593 {
return Index(pat.
Data(), patlen, i, cmp); }
596 {
return Replace(pos, 0, cs, cs ? strlen(cs) : 0); }
602 {
return Replace(pos, 0,
s.Data(),
s.Length()); }
608 {
return Replace(0, 0, cs, cs ? strlen(cs) : 0); }
614 {
return Replace(0, 0,
s.Data(),
s.Length()); }
629 {
return Replace(pos,
n, cs, cs ? strlen(cs) : 0); }
632 {
return Replace(pos,
n,
s.Data(),
s.Length()); }
648 {
return ReplaceAll(s1, s1 ? strlen(s1) : 0, s2, s2 ? strlen(s2) : 0); }
710 {
return !(s1 == s2); }
726 {
return !(s1 == s2); }
741 {
return (s2 == s1); }
744 {
return !(s2 == s1); }
763 {
return (s2 == s1); }
766 {
return (s2 == s1); }
769 {
return !(s1 == s2); }
772 {
return !(s1 == s2); }
775 {
return !(s1 == s2); }
778 {
return !(s2 == s1); }
781 {
return !(s2 == s1); }
A zero length substring is legal.
static Ssiz_t GetMaxWaste()
std::istream & ReadFile(std::istream &str)
Replace string with the contents of strm, stopping at an EOF.
void ToLower()
Convert sub-string to lower-case.
TSubString & operator=(const char *s)
Assign char* to sub-string.
const char * GetShortPointer() const
static TString Itoa(Int_t value, Int_t base)
Converts an Int_t to a TString with respect to the base specified (2-36).
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket...
friend TString operator+(const TString &s1, const TString &s2)
Use the special concatenation constructor.
UInt_t Hash(const TString &s)
static Ssiz_t MaxWaste(Ssiz_t mw=15)
Set maximum space that may be wasted in a string before doing a resize.
basic_string_view< char > string_view
char * Compress(const char *str)
Remove all blanks from the string str.
Bool_t EqualTo(const char *cs, ECaseCompare cmp=kExact) const
void ToUpper()
Convert sub-string to upper-case.
std::ostream & operator<<(std::ostream &str, const TString &s)
Write string to stream.
friend Bool_t operator==(const TSubString &s1, const TSubString &s2)
Compare two sub-strings.
ATTENTION: this class is obsolete.
TString & ReplaceAll(const TString &s1, const TString &s2)
std::istream & ReadLine(std::istream &str, Bool_t skipWhite=kTRUE)
Read a line from stream upto newline skipping any whitespace.
Bool_t IsFloat() const
Returns kTRUE if string contains a floating point or integer number.
char & operator[](Ssiz_t i)
void Clone(Ssiz_t nc)
Make self a distinct copy with capacity of at least tot, where tot cannot be smaller than the current...
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...
void ToUpper()
Change string to upper case.
int UnEscChar(const char *src, char *dst, int dstlen, char *specchars, char escchar)
Un-escape specchars in src from escchar and copy to dst.
Buffer base class used for serializing objects.
Regular expression class.
This class implements a mutex interface.
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Short_t Min(Short_t a, Short_t b)
void ToLower()
Change string to lower-case.
TString & operator=(char s)
Assign character c to TString.
static Ssiz_t ResizeIncrement(Ssiz_t ri=16)
Set default resize increment for all TStrings. Default is 16.
TString Copy() const
Copy a string.
TString & operator+=(const char *s)
std::istream & ReadToken(std::istream &str)
Read a token, delimited by whitespace, from the input stream.
std::istream & operator>>(std::istream &str, TString &s)
Read string from stream.
TString & Prepend(const char *cs)
const char * Data() const
static void WriteString(TBuffer &b, const TString *a)
Write TString object to buffer.
TSubString(const TSubString &s)
Bool_t MaybeWildcard() const
Returns true if string contains one of the wildcard characters "[]*?".
TString & Insert(Ssiz_t pos, const char *s)
char * Init(Ssiz_t capacity, Ssiz_t nchar)
Private member function returning an empty string representation of size capacity and containing ncha...
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.
Bool_t operator>=(const TString &s1, const TString &s2)
TString & Replace(Ssiz_t pos, Ssiz_t n, const char *s)
#define ClassDef(name, id)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
virtual void ReadBuffer(char *&buffer)
Read string from I/O buffer.
UInt_t HashFoldCase() const
Return a case-insensitive hash value (endian independent).
Bool_t IsAlnum() const
Returns true if all characters in string are alphanumeric.
static TString * ReadString(TBuffer &b, const TClass *clReq)
Read TString object from buffer.
Ssiz_t GetLongCap() const
void Clear()
Clear string without changing its capacity.
TString & Append(const char *cs)
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
static Ssiz_t Recommend(Ssiz_t s)
static Ssiz_t GetInitialCapacity()
void AssertElement(Ssiz_t nc) const
Check to make sure a string index is in range.
Ssiz_t First(char c) const
Find first occurrence of a character c.
TString operator+(const TString &s1, const TString &s2)
Use the special concatenation constructor.
Long64_t Atoll() const
Return long long value of string.
Bool_t IsAlpha() const
Returns true if all characters in string are alphabetic.
std::string_view View() const
Bool_t operator!=(const TString &s1, const TString &s2)
char & operator()(Ssiz_t i)
Bool_t IsOct() const
Returns true if all characters in string are octal digits (0-7).
Bool_t operator<=(const TString &s1, const TString &s2)
std::string printValue(const TDatime *val)
Print a TDatime at the prompt.
char & operator[](Ssiz_t i)
Return character at pos i from sub-string. Check validity of i.
Ssiz_t GetShortSize() const
char & operator()(Ssiz_t i)
Return character at pos i from sub-string. No check on i.
UInt_t HashCase() const
Return a case-sensitive hash value (endian independent).
Bool_t Gets(FILE *fp, Bool_t chop=kTRUE)
Read one line from the stream, including the , or until EOF.
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
char * Form(const char *fmt,...)
void SetLongCap(Ssiz_t s)
TString MD5() const
Return the MD5 digest for this string, in a string representation.
TSubString Strip(EStripType s=kTrailing, char c=' ') const
Return a substring of self stripped at beginning and/or end.
The ROOT global object gROOT contains a list of all defined classes.
char * Strip(const char *str, char c=' ')
Strip leading and trailing c (blanks by default) from a string.
void SetLongPointer(char *p)
static Ssiz_t GetResizeIncrement()
static Ssiz_t InitialCapacity(Ssiz_t ic=15)
Set default initial capacity for all TStrings. Default is 15.
void FormImp(const char *fmt, va_list ap)
Formats a string using a printf style format descriptor.
TString ToLower(const TString &s)
Return a lower-case version of str.
char * StrDup(const char *str)
Duplicate the string str.
const char * GetPointer() const
static const Ssiz_t kNPOS
void Clobber(Ssiz_t nc)
Clear string and make sure it has a capacity of nc.
TString & Remove(Ssiz_t pos)
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 IsDec() const
Returns true if all characters in string are decimal digits (0-9).
friend TBuffer & operator<<(TBuffer &b, const TString *obj)
Write TString or derived to TBuffer.
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
TString & Swap(TString &other)
void SetLongSize(Ssiz_t s)
void Printf(const char *fmt,...)
Ssiz_t Last(char c) const
Find last occurrence of a character c.
Ssiz_t GetLongSize() const
unsigned long long ULong64_t
Print a TSeq at the prompt:
void Puts(FILE *fp)
Write string to the stream.
virtual Int_t Sizeof() const
Returns size string will occupy on I/O buffer.
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.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
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...
static constexpr double s
void SetShortSize(Ssiz_t s)
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
Bool_t IsAscii() const
Returns true if all characters in string are ascii.
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 & ReadToDelim(std::istream &str, char delim='\n')
Read up to an EOF, or a delimiting character, whichever comes first.
void SubStringError(Ssiz_t, Ssiz_t, Ssiz_t) const
Output error message.
Bool_t operator>(const TString &s1, const TString &s2)
Bool_t operator==(const TString &s1, const TString &s2)
static Ssiz_t Align(Ssiz_t s)
TSubString(const TString &s, Ssiz_t start, Ssiz_t len)
Private constructor.
Short_t Max(Short_t a, Short_t b)
Bool_t IsHex() const
Returns true if all characters in string are hexadecimal digits (0-9,a-f,A-F).
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Bool_t IsBin() const
Returns true if all characters in string are binary digits (0,1).
Int_t CountChar(Int_t c) const
Return number of times character c occurs in the string.
Int_t Atoi() const
Return integer value of string.
TString ToUpper(const TString &s)
Return an upper-case version of str.
const char * GetLongPointer() const
static TString LLtoa(Long64_t value, Int_t base)
Converts a Long64_t to a TString with respect to the base specified (2-36).
TString()
TString default ctor.
Double_t Atof() const
Return floating-point value contained in string.
Bool_t IsDigit() const
Returns true if all characters in string are digits (0-9) or white spaces, i.e.
virtual void FillBuffer(char *&buffer) const
Copy string into I/O buffer.
Bool_t IsWhitespace() const
Bool_t operator<(const TString &s1, const TString &s2)
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...
void AssertElement(Ssiz_t i) const
Check to make sure a sub-string index is in range.
static constexpr double ns
friend Bool_t operator==(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.
Bool_t MaybeRegexp() const
Returns true if string contains one of the regexp characters "^$.[]*+?".
void InitChar(char c)
Initialize a string with a single character.
void Resize(Ssiz_t n)
Resize the string. Truncate or add blanks as necessary.
virtual ~TString()
Delete a TString.
std::string & operator+=(std::string &left, const TString &right)
const char * Data() const