Mode localization by structural imperfections in one-dimensional continuous systems