Name: breakup - Break a string or an array at given Substrings or SubArrays, or to given lengths.

Synopsis:

MyStr BreakStr breakup -&gt; StrArr 
MyArr BreakArr breakup -&gt; ArrArr 
MyStr SecLen   breakup -&gt; StrArr 
MyArr SecLen   breakup -&gt; ArrArr


Examples:

1. (home/kupper/synod) (/) breakup -&gt; [(home) (kupper) (synod)] 
2. (Theresnospaceinhere) ( ) breakup -&gt; [(Theresnospaceinhere)] 
3. [23 5 0 17 0] [0]   breakup -&gt; [ [23 5] [17] [] ] 
4. [23 5 0 17 0] [5 0] breakup -&gt; [ [23] [17 0] ] 
5. (abcdef) 3 breakup -&gt; [(abc) (def)] 
6. (abcdef) 4 breakup -&gt; [(abcd) (ef)] 
7  [1 2 3 4] 2 breakup -&gt; [[1 2] [3 4]]


Description:

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.


Parameters:

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)


Bugs:




Remarks:

Inspired by IDL's STRBREAK-function 
Procedure: Recursive call of "search"


Author:

R Kupper, H E Plesser


FirstVersion:

Apr 10 1999


SeeAlso:

trim

Source:

/var/www/debian/nest/nest-simulator-2.20.0/lib/sli/misc_helpers.sli
