Reimplementation of stringWithFormat: for educational purposes