| Author |
Comment/Response |
Tony
|
10/01/05 11:30am
Hi
Im trying to make function that divides a string into substrings with the size n and returns a list with the subtrings.
This is what I have so far, but I can't get it to work.
stringPartition[s_String, n_Integer] := Module[{tmp = 0, n2 = n, l = {}},
For[i = 1, i < StringLength[s], i = i + n,
tmp = StringTake[s, {i, n2}];
Append[l, tmp];
n2 = n2 + n;
];
Return[l];
]
URL: , |
|