Partition string into length n chunks
- To: mathgroup at smc.vnet.net
- Subject: [mg126532] Partition string into length n chunks
- From: David G <daggillies at gmail.com>
- Date: Thu, 17 May 2012 04:11:14 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
I am sure this is trivially simple, but how do I partition a string into non-overlapping length n chunks? The best I could come up with is chunk[s_, n_] := StringJoin[#] & /@ Partition[Characters[s], n] but this seems overly long-winded.
- Follow-Ups:
- Re: Partition string into length n chunks
- From: Bob Hanlon <hanlonr357@gmail.com>
- Re: Partition string into length n chunks