User Tools

Site Tools


root:strings

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
root:strings [2010/11/10 10:39] – created nchiaproot:strings [2010/11/10 12:01] (current) nchiap
Line 1: Line 1:
 ====== String manipulation ====== ====== String manipulation ======
 +For more details see the [[http://root.cern.ch/root/htmldoc/TString.html | TString Reference]].
  
 ==== Substring ==== ==== Substring ====
Line 9: Line 10:
  
 // e.g: remove S charachters form start and E from end // e.g: remove S charachters form start and E from end
-TString histName filename(S, filename.Length()-S-E);+TString new old(S, old.Length()-S-E);
 </code> </code>
  
Line 18: Line 19:
 </code> </code>
  
-If your variable is a TString, you need to convert it first+If your variable is a TString, you need to pass the underlying char array
 <code C++> <code C++>
-TString string = Form("My TString is %s", (char*tstring);+TString string = Form("My TString is %s", tstring.Data() );
 </code> </code>
  
 The function follows [[http://www.cplusplus.com/reference/clibrary/cstdio/printf/| printf]]-syntax The function follows [[http://www.cplusplus.com/reference/clibrary/cstdio/printf/| printf]]-syntax
  
root/strings.1289381942.txt.gz · Last modified: 2010/11/10 10:39 by nchiap