Add a truncate function.