Rebol Programming/Language Features/Parse/Simple splitting

String parsing involves simple splitting: parse "this is a string" none ; == ["this" "is" "a" "string"] By providing NONE as the PARSE rule, we are asking PARSE to break a string into a block of string(s) based on whitespace: whitespace: charset [#"^A" - #" " "^(7F)^(A0)"] and common delimiters: common-delimiter: charset ",;" To facilitate CSV splitting, quotation marks are handled specially (see the CSV example).

Empty string
parse "" none ; == []

No delimiters in the input string
parse "redbluegreen" none ; == ["redbluegreen"]

Space
parse "red blue green" none ; == ["red" "blue" "green"]

Comma
parse "red,blue,green" none ; == ["red" "blue" "green"]

Tab
parse "red^-blue^-green" none ; == ["red" "blue" "green"]

Semicolon
parse "red;blue;green" none ; == ["red" "blue" "green"]

Newline
string: { red blue green } parse string none ; == ["red" "blue" "green"]

Leading and trailing whitespaces are ignored
parse " 1 " none ; == ["1"]

A sequence of whitespaces is equivalent to one whitespace
parse "1 2" none ; == ["1" "2"]

Leading common delimiter delimits an empty substring
parse ",1" none ; == ["" "1"]

One trailing common delimiter is ignored
parse "1," none ; == ["1"]

A sequence of common delimiters delimits empty substrings between them
parse "1,,2" none ; == ["1" "" "2"]

CSV
parse {"red","blue","green"} none ; == ["red" "blue" "green"]