Search code examples
mathencodingmaple

Maple and substrings


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 ]]


Solution

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

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