Be concise.
Be useful.
All contributions dictatorially edited by webmasters to match personal tastes.
Please do not paste any copyright violating material.
Please try to avoid dependencies to third-party libraries and frameworks.
string[] chunks = s.Split(' ');
s.split(new RegExp('\\s+'))
chunks = String.split(s)
Chunks = string:tokens(S, [$\s]).
def chunks = s.split(/\s+/)
chunks = words s
let chunks = s.split(/ +/);
String chunks[] = s.split(" +");
val chunks = s.split("\\s+".toRegex())
(defun words (s)
(if (equalp s "") nil
(let ((p (position #\Space s )))
(cond ((null p) (list s))
((zerop p ) (words (subseq s 1)))
(T (cons (subseq s 0 p) (words (subseq s (+ 1 p )))))))))
(setf chunks (words s))
chunks = {}
for substring in s:gmatch("%S+") do
table.insert(chunks, substring)
end
$chunks = preg_split('/ +/', $s);
@chunks = split /\s+/, $s;
chunks = s.split()
chunks = s.split
let chunks: Vec<_> = s.split_ascii_whitespace().collect();
let chunks: Vec<_> = s.split(' ').collect();
let chunks: Vec<_> = s.split_whitespace().collect();
val chunks = s.split(" ")
(define (tokenize l)
(let loop ((t '())
(l l))
(if (pair? l)
(let ((c (car l)))
(if (char=? c #\space)
(cons (reverse t) (loop '() (cdr l)))
(loop (cons (car l) t) (cdr l))))
(if (null? t)
'()
(list (reverse t))))))
(define (string-split s)
(map list->string (tokenize (string->list s))))
chunks := s substrings