Created
December 27, 2018 23:45
-
-
Save Adron/c7bc7a244dee5d81a2cbe83326cc0b93 to your computer and use it in GitHub Desktop.
Build Twitter List Function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func buildTwitterList() []string { | |
theFile := viper.GetString("file") | |
theTwitterers, err := ioutil.ReadFile(theFile) | |
check(err) | |
stringTwitterers := string(theTwitterers[:]) | |
splitFields := strings.Fields(stringTwitterers) | |
var completedTwittererList []string | |
for _, aField := range splitFields { | |
if strings.HasPrefix(aField, "@") && aField != "@" { | |
reg, _ := regexp.Compile("[^a-zA-Z0-9_@]") | |
processedString := reg.ReplaceAllString(aField, "") | |
completedTwittererList = append(completedTwittererList, processedString) | |
} | |
} | |
return completedTwittererList | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment