code: func Truncate(str string, length int, ending string) string {
  	var aftstr, befstr string
  	if len(str) > length {
  		words := strings.Fields(str)
  		before, present := 0, 0
  		for i := range words {
  			befstr = aftstr
  			before = present
  			aftstr = aftstr + words[i] + " "
  			present = len(aftstr)
  			if present > length && i != 0 {
  				if (length - before) < (present - length) {
  					return Trim(befstr, " /\\.,\"'#!?&@+-") + ending
  				}
  				return Trim(aftstr, " /\\.,\"'#!?&@+-") + ending
  			}
  		}
  	}
  
  	return str
  }
docs: // Truncate a string to the closest length without breaking words.