Skip to tool

C++ Split into chunks Online

Split text into fixed-length chunks.

The output updates as you type. The tool processes input in your browser.

Worked example

Chunks have a fixed width and can break across words. Use word wrap when word boundaries need to be kept.

Chunk length
3
Chunk ending
"\\n"
Sample input
manualsplus
Sample output
man\nual\nspl\nus\n

Using this operation in C++

The interactive result uses JavaScript. std::string operates on char elements. With UTF-8 data, byte offsets and decoded character positions can differ.

C++ reference