Skip to content

Instantly share code, notes, and snippets.

@Bios-Marcel
Last active August 17, 2019 10:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Bios-Marcel/031cc200859442ba2bfd6e8d006eeab5 to your computer and use it in GitHub Desktop.
Save Bios-Marcel/031cc200859442ba2bfd6e8d006eeab5 to your computer and use it in GitHub Desktop.

**```go for _, urlMatch := range urlMatches { newURL := urlMatch[1] + urlMatch[2] if len(urlMatch) == 5 || (len(urlMatch) == 4 && len(urlMatch[3]) > 1) { newURL = newURL + urlMatch[3] } if (len(urlMatch[2]) + 35) < len(newURL) { newURL = fmt.Sprintf("(%s) ** %s", urlMatch[2], chatView.shortener.Shorten(newURL)) } if len(urlMatch) == 5 { newURL = newURL + strings.TrimSuffix(urlMatch[4], ">") } messageText = strings.Replace(messageText, urlMatch[0], newURL, 1) }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment