I have been looking for an elegant and efficient way to chunk a string into substrings of a given length in Ruby.
So far, the best I could come up with is this:
Are there some other constraints you have in mind? Otherwise I'd be awfully tempted to do something simple like
[0..10].each { str[(i*w),w] }