May 2018
Beginner
252 pages
6h 19m
English
You can split a string on spaces, or on other characters, or even on strings - all these are called the delimiter, and the result of the split is a series. Here are some examples of this:
;-- see Chapter05/strings-as-series.red:s1: "The quick brown fox jumps over the lazy dog"split s1 " " ;== ["The" "quick" "brown" "fox" "jumps" "over" "the" "lazy" "dog"]s2: "bracadabra"split s2 "a" ;== ["br" "c" "d" "br"]s3: "abracadabra"split s3 "a" ;== ["" "br" "c" "d" "br"]
From the last line, you can see that if the string starts with the delimiter, the first split item that will be found is an empty string "". The split word is very useful in the analysis and processing of text files.