code: func SwapCase(str string) string {
  	if str == "" {
  		return str
  	}
  	buffer := []rune(str)
  
  	whitespace := true
  
  	for i := 0; i < len(buffer); i++ {
  		ch := buffer[i]
  		if unicode.IsUpper(ch) {
  			buffer[i] = unicode.ToLower(ch)
  			whitespace = false
  		} else if unicode.IsTitle(ch) {
  			buffer[i] = unicode.ToLower(ch)
  			whitespace = false
  		} else if unicode.IsLower(ch) {
  			if whitespace {
  				buffer[i] = unicode.ToTitle(ch)
  				whitespace = false
  			} else {
  				buffer[i] = unicode.ToUpper(ch)
  			}
  		} else {
  			whitespace = unicode.IsSpace(ch)
  		}
  	}
  	return string(buffer)
  }
docs: /*
  SwapCase swaps the case of a string using a word based algorithm.
  
  Conversion algorithm:
  
      Upper case character converts to Lower case
      Title case character converts to Lower case
      Lower case character after Whitespace or at start converts to Title case
      Other Lower case character converts to Upper case
      Whitespace is defined by unicode.IsSpace(char).
  
  Parameters:
      str - the string to swap case
  
  Returns:
      the changed string
  */