truncate function and str