views:

72

answers:

2

Maybe this is the wrong website to ask, but hopefully somebody knows...

How do I break a string in Maple and store it in a list of substrings?

i.e. my string is : "i love the weekends"

and I want to break it into substrings of size 2... so i would look like this

substrs;

substrs = [[i ][lo][ve][ t][he][ w][ee][ke][nd][s ]]

+1  A: 

LengthSplit in the StringTools package seems to do what you want:

substrs := StringTools[LengthSplit]("i love the weekends", 2);
sth
this works great! How would you convert it to a list though?
+1  A: 

this works great! How would you convert it to a list though? – user69514 Apr 20 '09 at 17:36

Simple, just put a list constructor around it:

substrs := [StringTools[LengthSplit]("i love the weekends", 2)];
saforrest