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


Groups > comp.soft-sys.math.mathematica > #10110

Partition string into length n chunks

From David G <daggillies@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Partition string into length n chunks
Date 2012-05-17 08:13 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jp2bvf$506$1@smc.vnet.net> (permalink)

Show all headers | View raw


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.

Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Partition string into length n chunks David G <daggillies@gmail.com> - 2012-05-17 08:13 +0000
  Re: Partition string into length n chunks David Bailey <dave@removedbailey.co.uk> - 2012-05-18 09:24 +0000
  Re: Partition string into length n chunks Szabolcs Horvát <szhorvat@gmail.com> - 2012-05-18 09:27 +0000

csiph-web