Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #10133 > unrolled thread

Re: Partition string into length n chunks

Started byBob Hanlon <hanlonr357@gmail.com>
First post2012-05-18 09:29 +0000
Last post2012-05-18 09:29 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Partition string into length n chunks Bob Hanlon <hanlonr357@gmail.com> - 2012-05-18 09:29 +0000

#10133 — Re: Partition string into length n chunks

FromBob Hanlon <hanlonr357@gmail.com>
Date2012-05-18 09:29 +0000
SubjectRe: Partition string into length n chunks
Message-ID<jp54qj$gpg$1@smc.vnet.net>
A single argument function doesn't need an explicit argument when mapped

chunk[s_String, n_Integer] :=
 StringJoin /@ Partition[Characters[s], n]


Bob Hanlon


On Thu, May 17, 2012 at 4:11 AM, David G <daggillies@gmail.com> wrote:
> 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.
>

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web