TString

Hi,
Does anyone know how to remove these spaces between “=” and “2.75” produced by the following code?

root [0] TString str("x=")   
root [1] str += 2.75         
(class TString)"x=     2.75"
root [2] cout << str << endl;
x=     2.75

To circumvent this problem, do
TString str(Form(“x=%f”,2.75));

Rene

Thank you Rene, but there is another problem:

root [0] Float_t x = 2.75;
root [1] TString str(Form("x=%.2f", x));
root [2] cout << str << endl;
x=0.00

But I’m expecting to get “x=2.75”. Why does it give me zero?

Use Double_t instead of Float_t.
A Form (in the interpreter) accepts int, double, char*

Rene