Logo

Programming-Idioms

History of Idiom 49 > diff from v30 to v31

Edit summary for version 31 by programming-idioms.org:
[JS] Space characters only

Version 30

2017-06-05, 15:31:06

Version 31

2017-10-21, 18:37:04

Idiom #49 Split a space-separated string

Build list chunks consisting in substrings of input string s, separated by one or more space characters.

Illustration

Idiom #49 Split a space-separated string

Build list chunks consisting in substrings of input string s, separated by one or more space characters.

Illustration
Code
var chunks = s.split(/\s+/);
Code
var chunks = s.split(/ +/);