only perform final string += string if necessary

This avoids a superfluous string allocation in all cases where n > 1.