localfunctionsplit(s,sep)local parts={}
forsubinstring.gmatch(s,"[^"..sep.."]+") dotable.insert(parts,sub)
endreturn parts
end
uses sysutils;
parts := s.split([sep]);
@parts = splitquotemeta($sep), $s;
The first argument to split is actually a regular expression. Wrapping the separator character with quotemeta ensures it will treat pattern metacharacters as plain old characters.
Variable names starting with @ signify a list; those with a $ are scalars.
You must assign to a list variable to get a list returned.