Use character array directly; don't use substr.

Apply code review suggestion.