You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
300 B

  1. package main
  2. import "strings"
  3. func removeLinks(text string) string {
  4. words := strings.Split(text, " ")
  5. var cleaned []string
  6. for i := 0; i < len(words); i++ {
  7. if strings.Contains(words[i], "http") {
  8. } else {
  9. cleaned = append(cleaned, words[i])
  10. }
  11. }
  12. return strings.Join(cleaned, " ")
  13. }