My instinct tells me that it's the first example although I have nothing definitive to back this up with. If it were my code then I'd certainly use the first method, probably without the if statement, ie
l-txt = REPLACE(TRIM(l-txt), " ", " ").
Although, having said this, the 'do while' does...