use strchr instead of doing it manually