splitStringWidth

Splits string at max width while trying not to split words in half

T[]
splitStringWidth
(
T
)
(
T str
,
ulong max
)
if (
isSomeString!T
)

Parameters

str T

String to split

max ulong

Maximum width string allowed to be

Examples

string[] arr = "My work here is not done yet".splitStringWidth(7);
writeln(arr);
// ["My work", " here is ", "not ", "done ", "yet"]

Meta