breakup - Break a string or an array at given Substrings or SubArrays, or to given lengths.
MyStr BreakStr breakup -> StrArr
MyArr BreakArr breakup -> ArrArr
MyStr SecLen breakup -> StrArr
MyArr SecLen breakup -> ArrArr
1. (home/kupper/synod) (/) breakup -> [(home) (kupper) (synod)]
2. (Theresnospaceinhere) ( ) breakup -> [(Theresnospaceinhere)]
3. [23 5 0 17 0] [0] breakup -> [ [23 5] [17] [] ]
4. [23 5 0 17 0] [5 0] breakup -> [ [23] [17 0] ]
5. (abcdef) 3 breakup -> [(abc) (def)]
6. (abcdef) 4 breakup -> [(abcd) (ef)]
7 [1 2 3 4] 2 breakup -> [[1 2] [3 4]]
Break a string or an array at given Substrings or SubArrays, or to sections
of given length. In the latter case, the last section may be shorter, if
the section length does not evenly divide the string/array length.
In : MyStr(string)/MyArr(array): String/Array to break up.
BreakStr(string)/BreakArr(array): Substring/Subarray defining break points.
SecLen(int): Length of sections to form
Out: StrArr(array of strings)/ArrArr(array of arrays): array of partial strings/arrays (see example below)
Inspired by IDL's STRBREAK-function
Procedure: Recursive call of "search"
R Kupper, H E Plesser
Apr 10 1999
/var/www/debian/nest/nest-simulator-2.20.0/lib/sli/misc_helpers.sli