code: func truncateString(str string, num int) string {
  	text := str
  	if len(str) > num {
  		if num > 3 {
  			num -= 3
  		}
  		text = str[0:num] + "..."
  	}
  	return text
  }
docs: // truncateString reduces the length of the 'str' argument to 'num' - 3 and adds a '...' suffix to the tail.