Replace strchr() by index()