Parametrization of the longitudinal development of hadronic showers in sampling calorimeters