Replace loop with string/replace method