Mathematica 9 is now available
Student Support Forum
Student Support Forum: 'Divide string' topicStudent Support Forum > General > "Divide string"

Next Comment >Help | Reply To Topic
Author Comment/Response
10/01/05 11:30am


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;


URL: ,

Subject (listing for 'Divide string')
Author Date Posted
Divide string Tony 10/01/05 11:30am
Re: Divide string yehuda ben-s... 10/04/05 10:23am
Re: Divide string David Er 10/04/05 2:17pm
Re: Divide string alvin 10/06/05 02:44am
Next Comment >Help | Reply To Topic