Avoid needlessly calling the strchr function twice.