Logo ROOT   6.10/00
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TString.h
Go to the documentation of this file.
1 // @(#)root/base:$Id$
2 // Author: Fons Rademakers 04/08/95
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TString
13 #define ROOT_TString
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TString //
19 // //
20 // Basic string class. //
21 // //
22 // Cannot be stored in a TCollection... use TObjString instead. //
23 // //
24 //////////////////////////////////////////////////////////////////////////
25 
26 #include "TMathBase.h"
27 
28 #include "RStringView.h"
29 
30 #include <iosfwd>
31 #include <stdarg.h>
32 #include <stdio.h>
33 #include <string>
34 
35 #ifdef R__GLOBALSTL
36 namespace std { using ::string; }
37 #endif
38 
39 class TRegexp;
40 class TPRegexp;
41 class TString;
42 class TSubString;
43 class TObjArray;
44 class TVirtualMutex;
45 class TBufferFile;
46 
47 TString operator+(const TString &s1, const TString &s2);
48 TString operator+(const TString &s, const char *cs);
49 TString operator+(const char *cs, const TString &s);
50 TString operator+(const TString &s, char c);
51 TString operator+(const TString &s, Long_t i);
52 TString operator+(const TString &s, ULong_t i);
53 TString operator+(const TString &s, Long64_t i);
54 TString operator+(const TString &s, ULong64_t i);
55 TString operator+(char c, const TString &s);
56 TString operator+(Long_t i, const TString &s);
57 TString operator+(ULong_t i, const TString &s);
58 TString operator+(Long64_t i, const TString &s);
59 TString operator+(ULong64_t i, const TString &s);
60 Bool_t operator==(const TString &s1, const TString &s2);
61 Bool_t operator==(const TString &s1, const char *s2);
62 Bool_t operator==(const TSubString &s1, const TSubString &s2);
63 Bool_t operator==(const TSubString &s1, const TString &s2);
64 Bool_t operator==(const TSubString &s1, const char *s2);
65 
66 
67 //////////////////////////////////////////////////////////////////////////
68 // //
69 // TSubString //
70 // //
71 // The TSubString class allows selected elements to be addressed. //
72 // There are no public constructors. //
73 // //
74 //////////////////////////////////////////////////////////////////////////
75 class TSubString {
76 
77 friend class TStringLong;
78 friend class TString;
79 
80 friend Bool_t operator==(const TSubString &s1, const TSubString &s2);
81 friend Bool_t operator==(const TSubString &s1, const TString &s2);
82 friend Bool_t operator==(const TSubString &s1, const char *s2);
83 
84 private:
85  TString &fStr; // Referenced string
86  Ssiz_t fBegin; // Index of starting character
87  Ssiz_t fExtent; // Length of TSubString
88 
89  // NB: the only constructor is private
90  TSubString(const TString &s, Ssiz_t start, Ssiz_t len);
91 
92 protected:
93  void SubStringError(Ssiz_t, Ssiz_t, Ssiz_t) const;
94  void AssertElement(Ssiz_t i) const; // Verifies i is valid index
95 
96 public:
98  : fStr(s.fStr), fBegin(s.fBegin), fExtent(s.fExtent) { }
99 
100  TSubString &operator=(const char *s); // Assignment from a char*
101  TSubString &operator=(const TString &s); // Assignment from a TString
102  TSubString &operator=(const TSubString &s); // Assignment from a TSubString
103  char &operator()(Ssiz_t i); // Index with optional bounds checking
104  char &operator[](Ssiz_t i); // Index with bounds checking
105  char operator()(Ssiz_t i) const; // Index with optional bounds checking
106  char operator[](Ssiz_t i) const; // Index with bounds checking
107 
108  operator std::string_view() const { return std::string_view(Data(),fExtent); }
109  operator std::string() const { return std::string(Data(),fExtent); }
110 
111  const char *Data() const;
112  Ssiz_t Length() const { return fExtent; }
113  Ssiz_t Start() const { return fBegin; }
114  TString& String() { return fStr; }
115  void ToLower(); // Convert self to lower-case
116  void ToUpper(); // Convert self to upper-case
117 
118  // For detecting null substrings
119  Bool_t IsNull() const { return fBegin == kNPOS; }
120  int operator!() const { return fBegin == kNPOS; }
121 };
122 
123 
124 //////////////////////////////////////////////////////////////////////////
125 // //
126 // TString //
127 // //
128 //////////////////////////////////////////////////////////////////////////
129 class TString {
130 
131 friend class TStringLong;
132 friend class TSubString;
133 friend class TBufferFile;
134 
135 friend TString operator+(const TString &s1, const TString &s2);
136 friend TString operator+(const TString &s, const char *cs);
137 friend TString operator+(const char *cs, const TString &s);
138 friend TString operator+(const TString &s, char c);
139 friend TString operator+(const TString &s, Long_t i);
140 friend TString operator+(const TString &s, ULong_t i);
141 friend TString operator+(const TString &s, Long64_t i);
142 friend TString operator+(const TString &s, ULong64_t i);
143 friend TString operator+(char c, const TString &s);
144 friend TString operator+(Long_t i, const TString &s);
145 friend TString operator+(ULong_t i, const TString &s);
146 friend TString operator+(Long64_t i, const TString &s);
147 friend TString operator+(ULong64_t i, const TString &s);
148 friend Bool_t operator==(const TString &s1, const TString &s2);
149 friend Bool_t operator==(const TString &s1, const char *s2);
150 
151 private:
152 #ifdef R__BYTESWAP
153  enum { kShortMask = 0x01, kLongMask = 0x1 };
154 #else
155  enum { kShortMask = 0x80, kLongMask = 0x80000000 };
156 #endif
157 
158  struct LongStr_t
159  {
160  Ssiz_t fCap; // Max string length (including null)
161  Ssiz_t fSize; // String length (excluding null)
162  char *fData; // Long string data
163  };
164 
165  enum { kMinCap = (sizeof(LongStr_t) - 1)/sizeof(char) > 2 ?
166  (sizeof(LongStr_t) - 1)/sizeof(char) : 2 };
167 
168  struct ShortStr_t
169  {
170  unsigned char fSize; // String length (excluding null)
171  char fData[kMinCap]; // Short string data
172  };
173 
175 
176  enum { kNwords = sizeof(UStr_t) / sizeof(Ssiz_t)};
177 
178  struct RawStr_t
179  {
181  };
182 
183  struct Rep_t
184  {
185  union
186  {
190  };
191  };
192 
193 protected:
194 #ifndef __CINT__
195  Rep_t fRep; //! String data
196 #endif
197 
198  // Special concatenation constructor
199  TString(const char *a1, Ssiz_t n1, const char *a2, Ssiz_t n2);
200  void AssertElement(Ssiz_t nc) const; // Index in range
201  void Clobber(Ssiz_t nc); // Remove old contents
202  void InitChar(char c); // Initialize from char
203 
204  enum { kAlignment = 16 };
205  static Ssiz_t Align(Ssiz_t s) { return (s + (kAlignment-1)) & ~(kAlignment-1); }
206  static Ssiz_t Recommend(Ssiz_t s) { return (s < kMinCap ? kMinCap : Align(s+1)) - 1; }
207  static Ssiz_t AdjustCapacity(Ssiz_t oldCap, Ssiz_t newCap);
208 
209 private:
210  Bool_t IsLong() const { return Bool_t(fRep.fShort.fSize & kShortMask); }
211 #ifdef R__BYTESWAP
212  void SetShortSize(Ssiz_t s) { fRep.fShort.fSize = (unsigned char)(s << 1); }
213  Ssiz_t GetShortSize() const { return fRep.fShort.fSize >> 1; }
214 #else
215  void SetShortSize(Ssiz_t s) { fRep.fShort.fSize = (unsigned char)s; }
216  Ssiz_t GetShortSize() const { return fRep.fShort.fSize; }
217 #endif
218  void SetLongSize(Ssiz_t s) { fRep.fLong.fSize = s; }
219  Ssiz_t GetLongSize() const { return fRep.fLong.fSize; }
220  void SetSize(Ssiz_t s) { IsLong() ? SetLongSize(s) : SetShortSize(s); }
222  Ssiz_t GetLongCap() const { return fRep.fLong.fCap & ~kLongMask; }
223  void SetLongPointer(char *p) { fRep.fLong.fData = p; }
224  char *GetLongPointer() { return fRep.fLong.fData; }
225  const char *GetLongPointer() const { return fRep.fLong.fData; }
226  char *GetShortPointer() { return fRep.fShort.fData; }
227  const char *GetShortPointer() const { return fRep.fShort.fData; }
228  char *GetPointer() { return IsLong() ? GetLongPointer() : GetShortPointer(); }
229  const char *GetPointer() const { return IsLong() ? GetLongPointer() : GetShortPointer(); }
230 #ifdef R__BYTESWAP
231  static Ssiz_t MaxSize() { return kMaxInt - 1; }
232 #else
233  static Ssiz_t MaxSize() { return (kMaxInt >> 1) - 1; }
234 #endif
235  void UnLink() const { if (IsLong()) delete [] fRep.fLong.fData; }
236  void Zero() {
237  Ssiz_t (&a)[kNwords] = fRep.fRaw.fWords;
238  for (UInt_t i = 0; i < kNwords; ++i)
239  a[i] = 0;
240  }
241  char *Init(Ssiz_t capacity, Ssiz_t nchar);
242  void Clone(Ssiz_t nc); // Make self a distinct copy w. capacity nc
243  void FormImp(const char *fmt, va_list ap);
244  UInt_t HashCase() const;
245  UInt_t HashFoldCase() const;
246 
247 public:
248  enum EStripType { kLeading = 0x1, kTrailing = 0x2, kBoth = 0x3 };
250  static const Ssiz_t kNPOS = ::kNPOS;
251 
252  TString(); // Null string
253  explicit TString(Ssiz_t ic); // Suggested capacity
254  TString(const TString &s); // Copy constructor
255  TString(TString &&s); // Move constructor
256  TString(const char *s); // Copy to embedded null
257  TString(const char *s, Ssiz_t n); // Copy past any embedded nulls
258  TString(const std::string &s);
259  TString(char c);
260  TString(char c, Ssiz_t s);
261  TString(const std::string_view &sub);
262  TString(const TSubString &sub);
263 
264  virtual ~TString();
265 
266  // ROOT I/O interface
267  virtual void FillBuffer(char *&buffer) const;
268  virtual void ReadBuffer(char *&buffer);
269  virtual Int_t Sizeof() const;
270 
271  static TString *ReadString(TBuffer &b, const TClass *clReq);
272  static void WriteString(TBuffer &b, const TString *a);
273 
274  friend TBuffer &operator<<(TBuffer &b, const TString *obj);
275 
276  // C I/O interface
277  Bool_t Gets(FILE *fp, Bool_t chop=kTRUE);
278  void Puts(FILE *fp);
279 
280  // Type conversion
281  operator const char*() const { return GetPointer(); }
282  operator std::string_view() const { return std::string_view(GetPointer(),Length()); }
283 #if __cplusplus >= 201700L
284  explicit operator std::string() const { return std::string(GetPointer(),Length()); }
285 #endif
286 
287  // Assignment
288  TString &operator=(char s); // Replace string
289  TString &operator=(const char *s);
290  TString &operator=(const TString &s);
291  TString &operator=(const std::string &s);
292  TString &operator=(const std::string_view &s);
293  TString &operator=(const TSubString &s);
294  TString &operator+=(const char *s); // Append string
295  TString &operator+=(const TString &s);
296  TString &operator+=(char c);
307 
308  // Indexing operators
309  char &operator[](Ssiz_t i); // Indexing with bounds checking
310  char &operator()(Ssiz_t i); // Indexing with optional bounds checking
311  char operator[](Ssiz_t i) const;
312  char operator()(Ssiz_t i) const;
313  TSubString operator()(Ssiz_t start, Ssiz_t len) const; // Sub-string operator
314  TSubString operator()(const TRegexp &re) const; // Match the RE
315  TSubString operator()(const TRegexp &re, Ssiz_t start) const;
316  TSubString operator()(TPRegexp &re) const; // Match the Perl compatible Regular Expression
317  TSubString operator()(TPRegexp &re, Ssiz_t start) const;
318  TSubString SubString(const char *pat, Ssiz_t start = 0,
319  ECaseCompare cmp = kExact) const;
320 
321  // Non-static member functions
322  TString &Append(const char *cs);
323  TString &Append(const char *cs, Ssiz_t n);
324  TString &Append(const TString &s);
325  TString &Append(const TString &s, Ssiz_t n);
326  TString &Append(char c, Ssiz_t rep = 1); // Append c rep times
327  Int_t Atoi() const;
328  Long64_t Atoll() const;
329  Double_t Atof() const;
330  Bool_t BeginsWith(const char *s, ECaseCompare cmp = kExact) const;
331  Bool_t BeginsWith(const TString &pat, ECaseCompare cmp = kExact) const;
332  Ssiz_t Capacity() const { return (IsLong() ? GetLongCap() : kMinCap) - 1; }
334  TString &Chop();
335  void Clear();
336  int CompareTo(const char *cs, ECaseCompare cmp = kExact) const;
337  int CompareTo(const TString &st, ECaseCompare cmp = kExact) const;
338  Bool_t Contains(const char *pat, ECaseCompare cmp = kExact) const;
339  Bool_t Contains(const TString &pat, ECaseCompare cmp = kExact) const;
340  Bool_t Contains(const TRegexp &pat) const;
341  Bool_t Contains(TPRegexp &pat) const;
342  Int_t CountChar(Int_t c) const;
343  TString Copy() const;
344  const char *Data() const { return GetPointer(); }
345  Bool_t EndsWith(const char *pat, ECaseCompare cmp = kExact) const;
346  Bool_t EqualTo(const char *cs, ECaseCompare cmp = kExact) const;
347  Bool_t EqualTo(const TString &st, ECaseCompare cmp = kExact) const;
348  Ssiz_t First(char c) const;
349  Ssiz_t First(const char *cs) const;
350  void Form(const char *fmt, ...)
351 #if defined(__GNUC__) && !defined(__CINT__)
352  __attribute__((format(printf, 2, 3))) /* 1 is the this pointer */
353 #endif
354  ;
355  UInt_t Hash(ECaseCompare cmp = kExact) const;
356  Ssiz_t Index(const char *pat, Ssiz_t i = 0,
357  ECaseCompare cmp = kExact) const;
358  Ssiz_t Index(const TString &s, Ssiz_t i = 0,
359  ECaseCompare cmp = kExact) const;
360  Ssiz_t Index(const char *pat, Ssiz_t patlen, Ssiz_t i,
361  ECaseCompare cmp) const;
362  Ssiz_t Index(const TString &s, Ssiz_t patlen, Ssiz_t i,
363  ECaseCompare cmp) const;
364  Ssiz_t Index(const TRegexp &pat, Ssiz_t i = 0) const;
365  Ssiz_t Index(const TRegexp &pat, Ssiz_t *ext, Ssiz_t i = 0) const;
366  Ssiz_t Index(TPRegexp &pat, Ssiz_t i = 0) const;
367  Ssiz_t Index(TPRegexp &pat, Ssiz_t *ext, Ssiz_t i = 0) const;
368  TString &Insert(Ssiz_t pos, const char *s);
369  TString &Insert(Ssiz_t pos, const char *s, Ssiz_t extent);
370  TString &Insert(Ssiz_t pos, const TString &s);
371  TString &Insert(Ssiz_t pos, const TString &s, Ssiz_t extent);
372  Bool_t IsAscii() const;
373  Bool_t IsAlpha() const;
374  Bool_t IsAlnum() const;
375  Bool_t IsDigit() const;
376  Bool_t IsFloat() const;
377  Bool_t IsHex() const;
378  Bool_t IsBin() const;
379  Bool_t IsOct() const;
380  Bool_t IsDec() const;
381  Bool_t IsInBaseN(Int_t base) const;
382  Bool_t IsNull() const { return Length() == 0; }
383  Bool_t IsWhitespace() const { return (Length() == CountChar(' ')); }
384  Ssiz_t Last(char c) const;
385  Ssiz_t Length() const { return IsLong() ? GetLongSize() : GetShortSize(); }
386  Bool_t MaybeRegexp() const;
387  Bool_t MaybeWildcard() const;
388  TString MD5() const;
389  TString &Prepend(const char *cs); // Prepend a character string
390  TString &Prepend(const char *cs, Ssiz_t n);
391  TString &Prepend(const TString &s);
392  TString &Prepend(const TString &s, Ssiz_t n);
393  TString &Prepend(char c, Ssiz_t rep = 1); // Prepend c rep times
394  std::istream &ReadFile(std::istream &str); // Read to EOF or null character
395  std::istream &ReadLine(std::istream &str,
396  Bool_t skipWhite = kTRUE); // Read to EOF or newline
397  std::istream &ReadString(std::istream &str); // Read to EOF or null character
398  std::istream &ReadToDelim(std::istream &str, char delim = '\n'); // Read to EOF or delimitor
399  std::istream &ReadToken(std::istream &str); // Read separated by white space
400  TString &Remove(Ssiz_t pos); // Remove pos to end of string
401  TString &Remove(Ssiz_t pos, Ssiz_t n); // Remove n chars starting at pos
402  TString &Remove(EStripType s, char c); // Like Strip() but changing string directly
403  TString &Replace(Ssiz_t pos, Ssiz_t n, const char *s);
404  TString &Replace(Ssiz_t pos, Ssiz_t n, const char *s, Ssiz_t ns);
405  TString &Replace(Ssiz_t pos, Ssiz_t n, const TString &s);
406  TString &Replace(Ssiz_t pos, Ssiz_t n1, const TString &s, Ssiz_t n2);
407  TString &ReplaceAll(const TString &s1, const TString &s2); // Find&Replace all s1 with s2 if any
408  TString &ReplaceAll(const TString &s1, const char *s2); // Find&Replace all s1 with s2 if any
409  TString &ReplaceAll(const char *s1, const TString &s2); // Find&Replace all s1 with s2 if any
410  TString &ReplaceAll(const char *s1, const char *s2); // Find&Replace all s1 with s2 if any
411  TString &ReplaceAll(const char *s1, Ssiz_t ls1, const char *s2, Ssiz_t ls2); // Find&Replace all s1 with s2 if any
412  void Resize(Ssiz_t n); // Truncate or add blanks as necessary
413  TSubString Strip(EStripType s = kTrailing, char c = ' ') const;
414  TString &Swap(TString &other); // Swap the contents of this and other without reallocation
415  void ToLower(); // Change self to lower-case
416  void ToUpper(); // Change self to upper-case
417  TObjArray *Tokenize(const TString &delim) const;
418  Bool_t Tokenize(TString &tok, Ssiz_t &from, const char *delim = " ") const;
419 
420  // Static member functions
421  static UInt_t Hash(const void *txt, Int_t ntxt); // Calculates hash index from any char string.
422  static Ssiz_t InitialCapacity(Ssiz_t ic = 15); // Initial allocation capacity
423  static Ssiz_t MaxWaste(Ssiz_t mw = 15); // Max empty space before reclaim
424  static Ssiz_t ResizeIncrement(Ssiz_t ri = 16); // Resizing increment
425  static Ssiz_t GetInitialCapacity();
426  static Ssiz_t GetResizeIncrement();
427  static Ssiz_t GetMaxWaste();
428  static TString Itoa ( Int_t value, Int_t base); // Converts int to string with respect to the base specified (2-36)
429  static TString UItoa ( UInt_t value, Int_t base);
430  static TString LLtoa ( Long64_t value, Int_t base);
431  static TString ULLtoa (ULong64_t value, Int_t base);
432  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 (supported bases 2-36)
433  static TString Format(const char *fmt, ...)
434 #if defined(__GNUC__) && !defined(__CINT__)
435  __attribute__((format(printf, 1, 2)))
436 #endif
437  ;
438 
439  ClassDef(TString,2) //Basic string class
440 };
441 
442 // Related global functions
443 std::istream &operator>>(std::istream &str, TString &s);
444 std::ostream &operator<<(std::ostream &str, const TString &s);
445 #if defined(R__TEMPLATE_OVERLOAD_BUG)
446 template <>
447 #endif
448 TBuffer &operator>>(TBuffer &buf, TString *&sp);
449 TBuffer &operator<<(TBuffer &buf, const TString * sp);
450 
451 // Conversion operator (per se).
452 inline std::string& operator+=(std::string &left, const TString &right)
453 {
454  return left.append(right.Data());
455 }
456 
457 TString ToLower(const TString &s); // Return lower-case version of argument
458 TString ToUpper(const TString &s); // Return upper-case version of argument
459 
460 inline UInt_t Hash(const TString &s) { return s.Hash(); }
461 inline UInt_t Hash(const TString *s) { return s->Hash(); }
462  UInt_t Hash(const char *s);
463 
464 extern char *Form(const char *fmt, ...) // format in circular buffer
465 #if defined(__GNUC__) && !defined(__CINT__)
466 __attribute__((format(printf, 1, 2)))
467 #endif
468 ;
469 extern void Printf(const char *fmt, ...) // format and print
470 #if defined(__GNUC__) && !defined(__CINT__)
471 __attribute__((format(printf, 1, 2)))
472 #endif
473 ;
474 extern char *Strip(const char *str, char c = ' '); // strip c off str, free with delete []
475 extern char *StrDup(const char *str); // duplicate str, free with delete []
476 extern char *Compress(const char *str); // remove blanks from string, free with delele []
477 extern int EscChar(const char *src, char *dst, int dstlen, char *specchars,
478  char escchar); // copy from src to dst escaping specchars by escchar
479 extern int UnEscChar(const char *src, char *dst, int dstlen, char *specchars,
480  char escchar); // copy from src to dst removing escchar from specchars
481 
482 #ifdef NEED_STRCASECMP
483 extern int strcasecmp(const char *str1, const char *str2);
484 extern int strncasecmp(const char *str1, const char *str2, Ssiz_t n);
485 #endif
486 
487 //////////////////////////////////////////////////////////////////////////
488 // //
489 // Inlines //
490 // //
491 //////////////////////////////////////////////////////////////////////////
492 
493 inline TString &TString::Append(const char *cs)
494 { return Replace(Length(), 0, cs, cs ? strlen(cs) : 0); }
495 
496 inline TString &TString::Append(const char *cs, Ssiz_t n)
497 { return Replace(Length(), 0, cs, n); }
498 
499 inline TString &TString::Append(const TString &s)
500 { return Replace(Length(), 0, s.Data(), s.Length()); }
501 
503 { return Replace(Length(), 0, s.Data(), TMath::Min(n, s.Length())); }
504 
505 inline TString &TString::operator+=(const char *cs)
506 { return Append(cs, cs ? strlen(cs) : 0); }
507 
509 { return Append(s.Data(), s.Length()); }
510 
512 { return Append(c); }
513 
515 { char s[32]; sprintf(s, "%ld", i); return operator+=(s); }
516 
518 { char s[32]; sprintf(s, "%lu", i); return operator+=(s); }
519 
521 { return operator+=((Long_t) i); }
522 
524 { return operator+=((ULong_t) i); }
525 
527 { return operator+=((Long_t) i); }
528 
530 { return operator+=((ULong_t) i); }
531 
533 {
534  char s[32];
535  // coverity[secure_coding] Buffer is large enough: width specified in format
536  sprintf(s, "%.17g", f);
537  return operator+=(s);
538 }
539 
541 { return operator+=((Double_t) f); }
542 
544 {
545  char s[32];
546  // coverity[secure_coding] Buffer is large enough (2^64 = 20 digits).
547  sprintf(s, "%lld", l);
548  return operator+=(s);
549 }
550 
552 {
553  char s[32];
554  // coverity[secure_coding] Buffer is large enough (2^64 = 20 digits).
555  sprintf(s, "%llu", ul);
556  return operator+=(s);
557 }
558 
559 inline Bool_t TString::BeginsWith(const char *s, ECaseCompare cmp) const
560 { return Index(s, s ? strlen(s) : (Ssiz_t)0, (Ssiz_t)0, cmp) == 0; }
561 
562 inline Bool_t TString::BeginsWith(const TString &pat, ECaseCompare cmp) const
563 { return Index(pat.Data(), pat.Length(), (Ssiz_t)0, cmp) == 0; }
564 
565 inline Bool_t TString::Contains(const TString &pat, ECaseCompare cmp) const
566 { return Index(pat.Data(), pat.Length(), (Ssiz_t)0, cmp) != kNPOS; }
567 
568 inline Bool_t TString::Contains(const char *s, ECaseCompare cmp) const
569 { return Index(s, s ? strlen(s) : 0, (Ssiz_t)0, cmp) != kNPOS; }
570 
571 inline Bool_t TString::Contains(const TRegexp &pat) const
572 { return Index(pat, (Ssiz_t)0) != kNPOS; }
573 
575 { return Index(pat, (Ssiz_t)0) != kNPOS; }
576 
577 inline Bool_t TString::EqualTo(const char *cs, ECaseCompare cmp) const
578 { return (CompareTo(cs, cmp) == 0) ? kTRUE : kFALSE; }
579 
580 inline Bool_t TString::EqualTo(const TString &st, ECaseCompare cmp) const
581 { return (CompareTo(st, cmp) == 0) ? kTRUE : kFALSE; }
582 
583 inline Ssiz_t TString::Index(const char *s, Ssiz_t i, ECaseCompare cmp) const
584 { return Index(s, s ? strlen(s) : 0, i, cmp); }
585 
586 inline Ssiz_t TString::Index(const TString &s, Ssiz_t i, ECaseCompare cmp) const
587 { return Index(s.Data(), s.Length(), i, cmp); }
588 
589 inline Ssiz_t TString::Index(const TString &pat, Ssiz_t patlen, Ssiz_t i,
590  ECaseCompare cmp) const
591 { return Index(pat.Data(), patlen, i, cmp); }
592 
593 inline TString &TString::Insert(Ssiz_t pos, const char *cs)
594 { return Replace(pos, 0, cs, cs ? strlen(cs) : 0); }
595 
596 inline TString &TString::Insert(Ssiz_t pos, const char *cs, Ssiz_t n)
597 { return Replace(pos, 0, cs, n); }
598 
599 inline TString &TString::Insert(Ssiz_t pos, const TString &s)
600 { return Replace(pos, 0, s.Data(), s.Length()); }
601 
602 inline TString &TString::Insert(Ssiz_t pos, const TString &s, Ssiz_t n)
603 { return Replace(pos, 0, s.Data(), TMath::Min(n, s.Length())); }
604 
605 inline TString &TString::Prepend(const char *cs)
606 { return Replace(0, 0, cs, cs ? strlen(cs) : 0); }
607 
608 inline TString &TString::Prepend(const char *cs, Ssiz_t n)
609 { return Replace(0, 0, cs, n); }
610 
612 { return Replace(0, 0, s.Data(), s.Length()); }
613 
615 { return Replace(0, 0, s.Data(), TMath::Min(n, s.Length())); }
616 
618 { return Replace(pos, TMath::Max(0, Length()-pos), 0, 0); }
619 
621 { return Replace(pos, n, 0, 0); }
622 
624 { return Remove(TMath::Max(0, Length()-1)); }
625 
626 inline TString &TString::Replace(Ssiz_t pos, Ssiz_t n, const char *cs)
627 { return Replace(pos, n, cs, cs ? strlen(cs) : 0); }
628 
630 { return Replace(pos, n, s.Data(), s.Length()); }
631 
632 inline TString &TString::Replace(Ssiz_t pos, Ssiz_t n1, const TString &s,
633  Ssiz_t n2)
634 { return Replace(pos, n1, s.Data(), TMath::Min(s.Length(), n2)); }
635 
636 inline TString &TString::ReplaceAll(const TString &s1, const TString &s2)
637 { return ReplaceAll(s1.Data(), s1.Length(), s2.Data(), s2.Length()) ; }
638 
639 inline TString &TString::ReplaceAll(const TString &s1, const char *s2)
640 { return ReplaceAll(s1.Data(), s1.Length(), s2, s2 ? strlen(s2) : 0); }
641 
642 inline TString &TString::ReplaceAll(const char *s1, const TString &s2)
643 { return ReplaceAll(s1, s1 ? strlen(s1) : 0, s2.Data(), s2.Length()); }
644 
645 inline TString &TString::ReplaceAll(const char *s1,const char *s2)
646 { return ReplaceAll(s1, s1 ? strlen(s1) : 0, s2, s2 ? strlen(s2) : 0); }
647 
648 inline TString &TString::Swap(TString &other) {
649  // Swap the contents of other and this without reallocation.
650 #ifndef __CINT__
651  Rep_t tmp = other.fRep;
652  other.fRep = fRep;
653  fRep = tmp;
654 #endif
655  return *this;
656 }
657 
659 { return GetPointer()[i]; }
660 
661 inline char TString::operator()(Ssiz_t i) const
662 { return GetPointer()[i]; }
663 
665 { AssertElement(i); return GetPointer()[i]; }
666 
667 inline char TString::operator[](Ssiz_t i) const
668 { AssertElement(i); return GetPointer()[i]; }
669 
670 inline const char *TSubString::Data() const
671 {
672  // Return a pointer to the beginning of the substring. Note that the
673  // terminating null is in the same place as for the original
674  // TString, so this method is not appropriate for converting the
675  // TSubString to a string. To do that, construct a TString from the
676  // TSubString. For example:
677  //
678  // root [0] TString s("hello world")
679  // root [1] TSubString sub=s(0, 5)
680  // root [2] sub.Data()
681  // (const char* 0x857c8b8)"hello world"
682  // root [3] TString substr(sub)
683  // root [4] substr
684  // (class TString)"hello"
685 
686  return fStr.Data() + fBegin;
687 }
688 
689 // Access to elements of sub-string with bounds checking
690 inline char TSubString::operator[](Ssiz_t i) const
691 { AssertElement(i); return fStr.GetPointer()[fBegin+i]; }
692 
693 inline char TSubString::operator()(Ssiz_t i) const
694 { return fStr.GetPointer()[fBegin+i]; }
695 
697 { fStr = s.fStr; fBegin = s.fBegin; fExtent = s.fExtent; return *this; }
698 
699 
700 // String Logical operators
701 inline Bool_t operator==(const TString &s1, const TString &s2)
702 {
703  return ((s1.Length() == s2.Length()) &&
704  !memcmp(s1.Data(), s2.Data(), s1.Length()));
705 }
706 
707 inline Bool_t operator!=(const TString &s1, const TString &s2)
708 { return !(s1 == s2); }
709 
710 inline Bool_t operator<(const TString &s1, const TString &s2)
711 { return s1.CompareTo(s2) < 0; }
712 
713 inline Bool_t operator>(const TString &s1, const TString &s2)
714 { return s1.CompareTo(s2) > 0; }
715 
716 inline Bool_t operator<=(const TString &s1, const TString &s2)
717 { return s1.CompareTo(s2) <= 0; }
718 
719 inline Bool_t operator>=(const TString &s1, const TString &s2)
720 { return s1.CompareTo(s2) >= 0; }
721 
722 // Bool_t operator==(const TString &s1, const char *s2);
723 inline Bool_t operator!=(const TString &s1, const char *s2)
724 { return !(s1 == s2); }
725 
726 inline Bool_t operator<(const TString &s1, const char *s2)
727 { return s1.CompareTo(s2) < 0; }
728 
729 inline Bool_t operator>(const TString &s1, const char *s2)
730 { return s1.CompareTo(s2) > 0; }
731 
732 inline Bool_t operator<=(const TString &s1, const char *s2)
733 { return s1.CompareTo(s2) <= 0; }
734 
735 inline Bool_t operator>=(const TString &s1, const char *s2)
736 { return s1.CompareTo(s2) >= 0; }
737 
738 inline Bool_t operator==(const char *s1, const TString &s2)
739 { return (s2 == s1); }
740 
741 inline Bool_t operator!=(const char *s1, const TString &s2)
742 { return !(s2 == s1); }
743 
744 inline Bool_t operator<(const char *s1, const TString &s2)
745 { return s2.CompareTo(s1) > 0; }
746 
747 inline Bool_t operator>(const char *s1, const TString &s2)
748 { return s2.CompareTo(s1) < 0; }
749 
750 inline Bool_t operator<=(const char *s1, const TString &s2)
751 { return s2.CompareTo(s1) >= 0; }
752 
753 inline Bool_t operator>=(const char *s1, const TString &s2)
754 { return s2.CompareTo(s1) <= 0; }
755 
756 // SubString Logical operators
757 // Bool_t operator==(const TSubString &s1, const TSubString &s2);
758 // Bool_t operator==(const TSubString &s1, const char *s2);
759 // Bool_t operator==(const TSubString &s1, const TString &s2);
760 inline Bool_t operator==(const TString &s1, const TSubString &s2)
761 { return (s2 == s1); }
762 
763 inline Bool_t operator==(const char *s1, const TSubString &s2)
764 { return (s2 == s1); }
765 
766 inline Bool_t operator!=(const TSubString &s1, const char *s2)
767 { return !(s1 == s2); }
768 
769 inline Bool_t operator!=(const TSubString &s1, const TString &s2)
770 { return !(s1 == s2); }
771 
772 inline Bool_t operator!=(const TSubString &s1, const TSubString &s2)
773 { return !(s1 == s2); }
774 
775 inline Bool_t operator!=(const TString &s1, const TSubString &s2)
776 { return !(s2 == s1); }
777 
778 inline Bool_t operator!=(const char *s1, const TSubString &s2)
779 { return !(s2 == s1); }
780 
781 namespace llvm {
782  class raw_ostream;
783 }
784 
785 namespace cling {
786  std::string printValue(const TString* val);
787  std::string printValue(const TSubString* val);
788  std::string printValue(const std::string_view* val);
789 }
790 
791 #endif
A zero length substring is legal.
Definition: TString.h:75
static Ssiz_t GetMaxWaste()
Definition: TString.cxx:1571
TString MD5() const
Return the MD5 digest for this string, in a string representation.
Definition: TString.cxx:884
Ssiz_t fWords[kNwords]
Definition: TString.h:180
Ssiz_t Last(char c) const
Find last occurrence of a character c.
Definition: TString.cxx:875
std::istream & ReadFile(std::istream &str)
Replace string with the contents of strm, stopping at an EOF.
Definition: Stringio.cxx:28
void ToLower()
Convert sub-string to lower-case.
Definition: TString.cxx:1729
An array of TObjects.
Definition: TObjArray.h:37
Bool_t operator<(const TDatime &d1, const TDatime &d2)
Definition: TDatime.h:106
unsigned char fSize
Definition: TString.h:170
virtual void FillBuffer(char *&buffer) const
Copy string into I/O buffer.
Definition: TString.cxx:1217
TSubString & operator=(const char *s)
Assign char* to sub-string.
Definition: TString.cxx:1683
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:2079
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket...
Definition: TBufferFile.h:47
friend TString operator+(const TString &s1, const TString &s2)
Use the special concatenation constructor.
Definition: TString.cxx:1448
long long Long64_t
Definition: RtypesCore.h:69
UInt_t Hash(const TString &s)
Definition: TString.h:460
static Ssiz_t MaxWaste(Ssiz_t mw=15)
Set maximum space that may be wasted in a string before doing a resize.
Definition: TString.cxx:1599
char * Compress(const char *str)
Remove all blanks from the string str.
Definition: TString.cxx:2538
Bool_t MaybeRegexp() const
Returns true if string contains one of the regexp characters &quot;^$.[]*+?&quot;.
Definition: TString.cxx:896
void ToUpper()
Convert sub-string to upper-case.
Definition: TString.cxx:1741
Ssiz_t Length() const
Definition: TString.h:385
LongStr_t fL
Definition: TString.h:174
float Float_t
Definition: RtypesCore.h:53
Bool_t IsOct() const
Returns true if all characters in string are octal digits (0-7).
Definition: TString.cxx:1911
void Zero()
Definition: TString.h:236
friend Bool_t operator==(const TSubString &s1, const TSubString &s2)
Compare two sub-strings.
Definition: TString.cxx:1718
const Ssiz_t kNPOS
Definition: RtypesCore.h:115
ATTENTION: this class is obsolete.
Definition: TStringLong.h:31
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:636
void SubStringError(Ssiz_t, Ssiz_t, Ssiz_t) const
Output error message.
Definition: TString.cxx:1753
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.
Definition: TString.cxx:1944
unsigned short UShort_t
Definition: RtypesCore.h:36
std::istream & ReadLine(std::istream &str, Bool_t skipWhite=kTRUE)
Read a line from stream upto newline skipping any whitespace.
Definition: Stringio.cxx:65
TString & fStr
Definition: TString.h:85
char * GetShortPointer()
Definition: TString.h:226
Double_t Atof() const
Return floating-point value contained in string.
Definition: TString.cxx:2041
char & operator[](Ssiz_t i)
Definition: TString.h:664
Bool_t IsAlnum() const
Returns true if all characters in string are alphanumeric.
Definition: TString.cxx:1800
void Clone(Ssiz_t nc)
Make self a distinct copy with capacity of at least tot, where tot cannot be smaller than the current...
Definition: TString.cxx:1186
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...
Definition: TString.cxx:2106
void ToUpper()
Change string to upper case.
Definition: TString.cxx:1112
int UnEscChar(const char *src, char *dst, int dstlen, char *specchars, char escchar)
Un-escape specchars in src from escchar and copy to dst.
Definition: TString.cxx:2583
Buffer base class used for serializing objects.
Definition: TBuffer.h:40
Regular expression class.
Definition: TRegexp.h:31
This class implements a mutex interface.
Definition: TVirtualMutex.h:32
Basic string class.
Definition: TString.h:129
Short_t Min(Short_t a, Short_t b)
Definition: TMathBase.h:168
void ToLower()
Change string to lower-case.
Definition: TString.cxx:1099
int Int_t
Definition: RtypesCore.h:41
TString & operator=(char s)
Assign character c to TString.
Definition: TString.cxx:256
bool Bool_t
Definition: RtypesCore.h:59
TArc * a
Definition: textangle.C:12
Ssiz_t Start() const
Definition: TString.h:113
static Ssiz_t ResizeIncrement(Ssiz_t ri=16)
Set default resize increment for all TStrings. Default is 16.
Definition: TString.cxx:1589
TString & operator+=(const char *s)
Definition: TString.h:505
char * GetPointer()
Definition: TString.h:228
std::istream & ReadToken(std::istream &str)
Read a token, delimited by whitespace, from the input stream.
Definition: Stringio.cxx:127
RawStr_t fRaw
Definition: TString.h:189
Rep_t fRep
Definition: TString.h:195
TString & Prepend(const char *cs)
Definition: TString.h:605
static std::string format(double x, double y, int digits, int width)
Ssiz_t Length() const
Definition: TString.h:112
static void WriteString(TBuffer &b, const TString *a)
Write TString object to buffer.
Definition: TString.cxx:1335
TSubString(const TSubString &s)
Definition: TString.h:97
TString Copy() const
Copy a string.
Definition: TString.cxx:468
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Definition: TString.h:559
TString & Insert(Ssiz_t pos, const char *s)
Definition: TString.h:593
char * Init(Ssiz_t capacity, Ssiz_t nchar)
Private member function returning an empty string representation of size capacity and containing ncha...
Definition: TString.cxx:228
TBuffer & operator>>(TBuffer &buf, Tmpl *&obj)
Definition: TBuffer.h:374
TString & Replace(Ssiz_t pos, Ssiz_t n, const char *s)
Definition: TString.h:626
TBuffer & operator<<(TBuffer &buf, const Tmpl *obj)
Definition: TBuffer.h:390
const char * Data() const
Definition: TString.h:344
const char * GetShortPointer() const
Definition: TString.h:227
void UnLink() const
Definition: TString.h:235
Bool_t IsBin() const
Returns true if all characters in string are binary digits (0,1).
Definition: TString.cxx:1895
#define ClassDef(name, id)
Definition: Rtypes.h:297
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:2345
virtual void ReadBuffer(char *&buffer)
Read string from I/O buffer.
Definition: TString.cxx:1238
Ssiz_t GetShortSize() const
Definition: TString.h:216
static TString * ReadString(TBuffer &b, const TClass *clReq)
Read TString object from buffer.
Definition: TString.cxx:1269
void Clear()
Clear string without changing its capacity.
Definition: TString.cxx:1150
ECaseCompare
Definition: TString.h:249
TString & Append(const char *cs)
Definition: TString.h:493
static Ssiz_t Recommend(Ssiz_t s)
Definition: TString.h:206
static Ssiz_t GetInitialCapacity()
Definition: TString.cxx:1555
Int_t Atoi() const
Return integer value of string.
Definition: TString.cxx:1975
Ssiz_t Capacity() const
Definition: TString.h:332
Bool_t operator!=(const TDatime &d1, const TDatime &d2)
Definition: TDatime.h:104
TString operator+(const TString &s1, const TString &s2)
Use the special concatenation constructor.
Definition: TString.cxx:1448
void AssertElement(Ssiz_t nc) const
Check to make sure a string index is in range.
Definition: TString.cxx:1125
char & operator()(Ssiz_t i)
Definition: TString.h:658
void AssertElement(Ssiz_t i) const
Check to make sure a sub-string index is in range.
Definition: TString.cxx:1762
std::string printValue(const TDatime *val)
Print a TDatime at the prompt.
Definition: TDatime.cxx:514
char & operator[](Ssiz_t i)
Return character at pos i from sub-string. Check validity of i.
Definition: TString.cxx:1655
int operator!() const
Definition: TString.h:120
Bool_t IsDec() const
Returns true if all characters in string are decimal digits (0-9).
Definition: TString.cxx:1927
Bool_t operator>(const TDatime &d1, const TDatime &d2)
Definition: TDatime.h:110
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
Definition: TString.cxx:2231
Ssiz_t GetLongSize() const
Definition: TString.h:219
LongStr_t fLong
Definition: TString.h:187
TSubString SubString(const char *pat, Ssiz_t start=0, ECaseCompare cmp=kExact) const
Returns a substring matching &quot;pattern&quot;, or the null substring if there is no such match...
Definition: TString.cxx:1644
Bool_t EqualTo(const char *cs, ECaseCompare cmp=kExact) const
Definition: TString.h:577
char & operator()(Ssiz_t i)
Return character at pos i from sub-string. No check on i.
Definition: TString.cxx:1664
Bool_t Gets(FILE *fp, Bool_t chop=kTRUE)
Read one line from the stream, including the , or until EOF.
Definition: Stringio.cxx:198
char * Strip(const char *str, char c= ' ')
Strip leading and trailing c (blanks by default) from a string.
Definition: TString.cxx:2488
static Ssiz_t MaxSize()
Definition: TString.h:233
Ssiz_t fExtent
Definition: TString.h:87
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2332
unsigned int UInt_t
Definition: RtypesCore.h:42
char * Form(const char *fmt,...)
void SetLongCap(Ssiz_t s)
Definition: TString.h:221
short Short_t
Definition: RtypesCore.h:35
TLine * l
Definition: textangle.C:4
Bool_t IsWhitespace() const
Definition: TString.h:383
TSubString Strip(EStripType s=kTrailing, char c= ' ') const
Return a substring of self stripped at beginning and/or end.
Definition: TString.cxx:1080
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:71
UInt_t HashFoldCase() const
Return a case-insensitive hash value (endian independent).
Definition: TString.cxx:601
void SetLongPointer(char *p)
Definition: TString.h:223
Int_t CountChar(Int_t c) const
Return number of times character c occurs in the string.
Definition: TString.cxx:454
Bool_t IsNull() const
Definition: TString.h:382
static Ssiz_t GetResizeIncrement()
Definition: TString.cxx:1563
ShortStr_t fShort
Definition: TString.h:188
std::istream & ReadToDelim(std::istream &str, char delim= '\n')
Read up to an EOF, or a delimiting character, whichever comes first.
Definition: Stringio.cxx:89
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
Definition: TString.cxx:2251
ShortStr_t fS
Definition: TString.h:174
#define Printf
Definition: TGeoToOCC.h:18
static Ssiz_t InitialCapacity(Ssiz_t ic=15)
Set default initial capacity for all TStrings. Default is 15.
Definition: TString.cxx:1580
void FormImp(const char *fmt, va_list ap)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2297
TString ToLower(const TString &s)
Return a lower-case version of str.
Definition: TString.cxx:1404
char * StrDup(const char *str)
Duplicate the string str.
Definition: TString.cxx:2524
const Bool_t kFALSE
Definition: RtypesCore.h:92
static const Ssiz_t kNPOS
Definition: TString.h:250
void Clobber(Ssiz_t nc)
Clear string and make sure it has a capacity of nc.
Definition: TString.cxx:1158
TString & Remove(Ssiz_t pos)
Definition: TString.h:617
long Long_t
Definition: RtypesCore.h:50
int Ssiz_t
Definition: RtypesCore.h:63
friend TBuffer & operator<<(TBuffer &b, const TString *obj)
Write TString or derived to TBuffer.
Definition: TString.cxx:1377
char * GetLongPointer()
Definition: TString.h:224
TString & Swap(TString &other)
Definition: TString.h:648
double f(double x)
void SetLongSize(Ssiz_t s)
Definition: TString.h:218
double Double_t
Definition: RtypesCore.h:55
Long64_t Atoll() const
Return long long value of string.
Definition: TString.cxx:2001
unsigned long long ULong64_t
Definition: RtypesCore.h:70
Ssiz_t fBegin
Definition: TString.h:86
void Puts(FILE *fp)
Write string to the stream.
Definition: Stringio.cxx:223
unsigned long ULong_t
Definition: RtypesCore.h:51
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.
Definition: TString.cxx:2181
Bool_t IsFloat() const
Returns kTRUE if string contains a floating point or integer number.
Definition: TString.cxx:1845
Bool_t MaybeWildcard() const
Returns true if string contains one of the wildcard characters &quot;[]*?&quot;.
Definition: TString.cxx:908
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...
Definition: TString.cxx:2158
UInt_t HashCase() const
Return a case-sensitive hash value (endian independent).
Definition: TString.cxx:572
void SetShortSize(Ssiz_t s)
Definition: TString.h:215
void SetSize(Ssiz_t s)
Definition: TString.h:220
char fData[kMinCap]
Definition: TString.h:171
Bool_t IsLong() const
Definition: TString.h:210
int EscChar(const char *src, char *dst, int dstlen, char *specchars, char escchar)
Escape specchars in src with escchar and copy to dst.
Definition: TString.cxx:2559
Bool_t IsDigit() const
Returns true if all characters in string are digits (0-9) or white spaces, i.e.
Definition: TString.cxx:1817
Bool_t operator==(const TDatime &d1, const TDatime &d2)
Definition: TDatime.h:102
const char * GetPointer() const
Definition: TString.h:229
static Ssiz_t Align(Ssiz_t s)
Definition: TString.h:205
TSubString(const TString &s, Ssiz_t start, Ssiz_t len)
Private constructor.
Definition: TString.cxx:1618
Short_t Max(Short_t a, Short_t b)
Definition: TMathBase.h:200
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:568
Bool_t IsNull() const
Definition: TString.h:119
const Int_t kMaxInt
Definition: RtypesCore.h:103
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
Definition: TRolke.cxx:630
virtual Int_t Sizeof() const
Returns size string will occupy on I/O buffer.
Definition: TString.cxx:1308
TString ToUpper(const TString &s)
Return an upper-case version of str.
Definition: TString.cxx:1418
static TString LLtoa(Long64_t value, Int_t base)
Converts a Long64_t to a TString with respect to the base specified (2-36).
Definition: TString.cxx:2131
TString()
TString default ctor.
Definition: TString.cxx:88
const char * Data() const
Definition: TString.h:670
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition: TString.h:583
Bool_t IsAlpha() const
Returns true if all characters in string are alphabetic.
Definition: TString.cxx:1785
const Bool_t kTRUE
Definition: RtypesCore.h:91
Bool_t IsHex() const
Returns true if all characters in string are hexadecimal digits (0-9,a-f,A-F).
Definition: TString.cxx:1879
const Int_t n
Definition: legend1.C:16
friend Bool_t operator==(const TString &s1, const TString &s2)
TString & String()
Definition: TString.h:114
static Ssiz_t AdjustCapacity(Ssiz_t oldCap, Ssiz_t newCap)
Calculate a nice capacity greater than or equal to newCap.
Definition: TString.cxx:1135
Ssiz_t GetLongCap() const
Definition: TString.h:222
Ssiz_t First(char c) const
Find first occurrence of a character c.
Definition: TString.cxx:477
EStripType
Definition: TString.h:248
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
Definition: TString.cxx:396
Bool_t IsAscii() const
Returns true if all characters in string are ascii.
Definition: TString.cxx:1772
void InitChar(char c)
Initialize a string with a single character.
Definition: TString.cxx:136
void Resize(Ssiz_t n)
Resize the string. Truncate or add blanks as necessary.
Definition: TString.cxx:1069
TString & Chop()
Definition: TString.h:623
const char * GetLongPointer() const
Definition: TString.h:225
virtual ~TString()
Delete a TString.
Definition: TString.cxx:219
Bool_t operator>=(const TDatime &d1, const TDatime &d2)
Definition: TDatime.h:112
std::string & operator+=(std::string &left, const TString &right)
Definition: TString.h:452
Bool_t operator<=(const TDatime &d1, const TDatime &d2)
Definition: TDatime.h:108
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.
Definition: TString.cxx:616