Stability of solutions to nonlinear wave equations with switching time delay