Rewrote the string truncation substitution that was not POSIX-compliant