-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstring_man.js
More file actions
39 lines (30 loc) · 1010 Bytes
/
string_man.js
File metadata and controls
39 lines (30 loc) · 1010 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
var long_string = "this is a string that i will try to break into a multitude of tiny pieces";
//var txt = long_string.split("");
var short_string = new String("");
const tweet_length = 10;
if (long_string.length%tweet_length === 0)
{
var num_tweets = long_string.length/tweet_length;
}
else
{
var num_tweets = Math.floor(long_string.length/tweet_length);
console.log(num_tweets)
}
for (i = 0; i <= num_tweets; i++)
{
short_string = long_string.substr(i*tweet_length, tweet_length);
// console.log(i*tweet_length);
// console.log((i+1)*tweet_length);
setTimeout(function(){
console.log(short_string)
},2000);
// console.log(short_string);
}
// console.log(long_string.substr(num_tweets*tweet_length));
// short_string = long_string.substr(tweet_length,2*tweet_length)
// console.log(short_string)
// console.log(__dirname);
// const fs = require('fs');
// var stringy = fs.readFileSync( __dirname + "/tweetfromhere.txt").toString();
// console.log(stringy)