Re: [ROOT] How to extract from string

From: Brett Viren (bv@bnl.gov)
Date: Mon Jul 22 2002 - 20:30:40 MEST


STL's string has 

	string string::substr(begin_index, end_index).  

The indices count from 0.

-Brett.

Simon Dean writes:
 > Hi Shawn,
 > 
 > You could try doing 
 > 
 > char mystring[200] = <the_name_of_your_TString_here>->Data();
 > 
 > and then you could access whichever part of the string you wanted by using
 > the index; mystring[67] or whatever. Obviously, 'mystring' needs to be big
 > enough to accomodate your TString.
 > 
 > Hope that helps,
 > 
 > cheers,
 > 
 > Simon
 > 
 > 
 > 
 > On Mon, 22 Jul 2002, Shawn Kwang wrote:
 > 
 > > Roottalk,
 > > 
 > >     I want to extract a portion of a string (TString class).  All I know is 
 > > that the first character of the portion to be extracted starts at position 
 > > 67.  The portion is not constant so I can't use TString::Substring (since it 
 > > looks for a pattern).
 > > 
 > >     I thought there might be a ROOT function that does what I want, 
 > > TString:Strip but I am not sure.
 > > 
 > > TIA,
 > > Shawn Kwang
 > > 
 > 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:00 MET