Re: [ROOT] TSubString TString::operator(Ssiz_t start, Ssiz_t len)

From: Edmond Offermann (edmondoffermann@yahoo.com)
Date: Thu Oct 16 2003 - 19:08:23 MEST


Hi,

That is ok. Have a look at the private
TSubString constructor and

inline const char* TSubString::Data() const
{ return fStr->Data() + fBegin; }

Probably what you are looking for is:

TString str = "Some sunny day"
TString sbstr = str(5,5)

This will give in sbstr "sunny

Eddy 



--- Frankland John <frankland@ganil.fr> wrote:
> Hello all
> 
> a quick and simple question:
> if I have a TString and I want to get the substring
> starting at index i1 
> of length len,
> why doesn't this work ?
> 
> TString str = "Some sunny day"
> TSubString sbstr = str(5,5)
> sbstr.Data()// should give "sunny", but instead I
> get "sunny day" ???
> 
> Where am I going wrong ?
> Cheers
> John
> 
> 3.10/01 RH9 gcc3.2.2
> -- 
> 
> John D. Frankland <mailto:frankland@ganil.fr>
> Beam Coordinator
> GANIL
> B.P. 55027
> 14076 CAEN Cedex 05
> 
> *tel:* +33 (0)231454628
> *fax:* +33 (0)231454665
> 
> 
> 



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:16 MET