`split` turns a Julia string into an array of parts. It is handy when a line of input contains fields separated by a character: `split("hawaiian,S,10.5", ',')` produces `"hawaiian"`, `"S"`, and `"10.5"`. section 5.3.2
The parts are still text. To calculate with the price, convert it afterward: `parse(Float64, "10.5")` gives `10.5`. In a file-reading loop, `readline` gets each record, `split` separates its fields, and `parse` converts fields that need numeric values. section 5.3.2 section 17.1
Splitting on a condition
A character-testing function can choose split points: `split("The quick brown fox", isspace)` splits on whitespace. But the matching characters disappear. For `"oneTwoThreeFour"`, `split(s, isuppercase)` yields `"one"`, `"wo"`, `"hree"`, and `"our"`—not the words needed for a camel-case conversion. Use `findall(isuppercase, s)` and string ranges when those capital letters must be kept. section 11.2.1
Listing 5.8 Loading pizza sales data
function load_pizzatable(io)
pizzas = [] #1
readline(io) #2
while !eof(io) #3
pz = split(readline(io), ',')
pr = parse(Float64, price(pz)) #4
sz = portion(pz)
push!(pizzas, (name(pz), sz[1], pr)) #5
end
pizzas
end
A complete pizza-sales loader shows `split` between reading a line and parsing its price. section 5.3.2










