Avoid `lastIndexOf`