Timeline for Split string into sub-strings of length n
Current License: CC BY-SA 3.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 14, 2023 at 2:31 | comment | added | tueda |
With v10.3, one can use UpTo : StringJoin @@@ Partition[Characters[str], UpTo[n]] .
|
|
Oct 3, 2012 at 18:31 | history | edited | kale | CC BY-SA 3.0 |
explained use of function
|
Oct 3, 2012 at 18:28 | comment | added | J. M.'s missing motivation♦ | True. I suppose that depends on whether the length of OP's strings would always be commensurate with the partition length... | |
Oct 3, 2012 at 18:25 | comment | added | kale |
@J.M. If the string was a character longer, it would be lost with a partition size of two. splitstring["ABCDEabcde12345", 2] outputs {"AB", "CD", "Ea", "bc", "de", "12", "34"} .
|
|
Oct 3, 2012 at 18:24 | review | Low quality posts | |||
Oct 3, 2012 at 18:34 | |||||
Oct 3, 2012 at 18:22 | comment | added | kale | @J.M., only if you have a multiple of the partition size. Right? Your way drops characters at the end in some instances. | |
Oct 3, 2012 at 18:21 | comment | added | J. M.'s missing motivation♦ |
StringJoin @@@ Partition[Characters[str], n] works just as well.
|
|
Oct 3, 2012 at 18:20 | comment | added | kale | ...the non-expert answer. | |
Oct 3, 2012 at 18:19 | history | answered | kale | CC BY-SA 3.0 |