Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (() => {
- const str = 'v13.9.0, v12.16.1, v11.15.0, v10.19.0, v9.11.2, v8.17.0, v7.10.1, v6.17.1, v5.12.0, v4.9.1';
- const max_chars = 25;
- let tail = max_chars;
- let comma_found = null;
- let lines = [];
- while (tail < str.length){
- for (let i = tail; i < 0 || !comma_found; i -=1){
- if (str[i] === ','){
- comma_found = true;
- lines.push(str.slice(tail - max_chars, i + 1));
- }
- }
- comma_found = false;
- tail += max_chars;
- }
- const result = lines.join('\n');
- console.log(result);
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement