Why not just `name[index] = ' '`? And right now it returns a string of length + 1 because you add the space.