4.06 SPLIT and JOIN
Splits a string using the specified delimiters and stores the result in an array.
Optionally it will call a user defined function that can make changes to each word before storing it in the array.
SPLIT string, words [, delimiters [, pairs]] [USE expr]
- the string to be split
- the target array
- a list of characters that are to be used to split the string. If this is omitted the default is a space.
- a string containing enclosing pairs of characters. Any delimiters found that are enclosed by any of the specified pairs will be ignored.
- the name of a function to be called to process each output string before storing it.
str = "/etc/temp/filename.ext" split str, words, "/." for each word in words put " [":word:"]" next // displays:  [etc] [temp] [filename] [ext]
Returns a specified string made up of each element of the array joined together.
JOIN words, string [, separator]
- the array containing the elements to be joined.
- the target string
- the character to be used to separate each array element in the output string. If the separator is omitted it defaults to a space.
st = "/etc/temp/filename.ext" split st, words, "/." join words, st, "/" put "[";s;"]" // displays: [/etc/temp/filename/ext]