Actually, even the STRIP function doesn't work on certain OSes. Same reason goes for using RTRIM & LTRIM functions, instead of TRIM function.
You're right that REPLACE will remove all 0s in the variable, but if you read the code completely, you'll see I'm repopulating the blank fields again with zero.