11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
var text = {
getParagraph: function* (sText) {
// generator: returns paragraphs of text
let iStart = 0;
let iEnd = 0;
sText = sText.replace("\r", "");
while ((iEnd = sText.indexOf("\n", iStart)) !== -1) {
yield sText.slice(iStart, iEnd);
iStart = iEnd + 1;
}
yield sText.slice(iStart);
},
|
|
|
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
var text = {
getParagraph: function* (sText) {
// generator: returns paragraphs of text
let iStart = 0;
let iEnd = 0;
sText = sText.replace("\r\n", "\n").replace("\r", "\n");
while ((iEnd = sText.indexOf("\n", iStart)) !== -1) {
yield sText.slice(iStart, iEnd);
iStart = iEnd + 1;
}
yield sText.slice(iStart);
},
|