string truncate function sample