Skip to content

Instantly share code, notes, and snippets.

@kjaymiller
Last active August 16, 2017 18:23
Show Gist options
  • Save kjaymiller/d92a63279350aa051fd137d6e2b39e09 to your computer and use it in GitHub Desktop.
Save kjaymiller/d92a63279350aa051fd137d6e2b39e09 to your computer and use it in GitHub Desktop.
Tweet Stormer created by kjaymiller - https://repl.it/KMRm/4
var text = prompt("Enter Your Tweet");
var txt_split = text.match(/\(?[^\.\?\!]+[\.!\?]\)?/g);
txt_split = txt_split.map((e) => e.trim());
txt_split;
var final_tweets = [''];
for (i = 0, a = 0; a < txt_split.length;) {
if (txt_split[a].length + final_tweets[i].length < 135) {
final_tweets[i] = final_tweets[i] + txt_split[a];
a++
}
else {
i++;
final_tweets[i] = '';
}
}
total_tweets = final_tweets.length;
for (i = 0; i < final_tweets.length ; i++) {
tweet_index = i + 1;
final_tweets[i] = tweet_index.toString() + "/" + total_tweets.toString() + " " + final_tweets[i];
}
final_tweets;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment