Files
lo/docs/data/core-chunkstring.md
T
2025-10-06 17:15:49 +02:00

29 lines
592 B
Markdown

---
name: ChunkString
slug: chunkstring
sourceRef: string.go#L130
category: core
subCategory: string
playUrl: https://go.dev/play/p/__FLTuJVz54
variantHelpers:
- core#string#chunkstring
similarHelpers:
- core#slice#chunk
- core#string#substring
- core#string#words
- core#string#runelength
- core#string#split
position: 20
signatures:
- "func ChunkString[T ~string](str T, size int) []T"
---
Splits a string into chunks of the given size. The last chunk may be shorter. Returns [""] for empty input.
```go
lo.ChunkString("1234567", 2)
// []string{"12", "34", "56", "7"}
```