Trim output string