UKHeliBob:
The key requirement seems to be
I said "at most" --> some engineering required 
something like this may be
char veryLongString[] = "0123456789ABCDEFGHIJ My very photogenic mother died in a freak accident (picnic, lightning) when I was three, and, save for a pocket of warmth in the darkest past, nothing of her subsists within the hollows and dells of memory, over which, if you can still stand my style (I am writing under observation), the sun of my infancy had set: surely, you all know those redolent remnants of day suspended, with the midges, about some hedge in bloom or suddenly entered and traversed by the rambler, at the bottom of a hill, in the summer dusk; a furry warmth, golden midges.";
void printCol(const char* s, const size_t nbCol = 32)
{
char tmpBuffer[nbCol + 1];
tmpBuffer[nbCol] = '\0'; // ensure null terminated C string
size_t len = strlen(s);
size_t pos = 0;
while (pos < len) {
strncpy(tmpBuffer, &(s[pos]), nbCol);
char * lastSpace = strrchr(tmpBuffer, ' ');
if (strlen(tmpBuffer) >= nbCol) {
if (lastSpace) {
*lastSpace = '\0';
pos++; // +1 to start after the space
}
}
pos += strlen(tmpBuffer);
char * skipStartingSpace = tmpBuffer;
while (*skipStartingSpace == ' ') skipStartingSpace++;
Serial.println(skipStartingSpace);
}
}
void setup() {
Serial.begin(115200);
Serial.println(F("\n\n----- 80 columns -----"));
printCol(veryLongString, 80);
Serial.println(F("\n\n----- 32 columns -----"));
printCol(veryLongString); // 32 is default so no need to pass the parameter
Serial.println(F("\n\n----- 10 columns -----"));
printCol(veryLongString, 10);
Serial.println(F("\n\n----- 1 column -----"));
printCol(veryLongString, 1);
}
void loop() {}
Serial Monitor (@ 115200 bauds) will show
[color=purple]
----- 80 columns -----
0123456789ABCDEFGHIJ My very photogenic mother died in a freak accident
(picnic, lightning) when I was three, and, save for a pocket of warmth in the
darkest past, nothing of her subsists within the hollows and dells of memory,
over which, if you can still stand my style (I am writing under observation),
the sun of my infancy had set: surely, you all know those redolent remnants of
day suspended, with the midges, about some hedge in bloom or suddenly entered
and traversed by the rambler, at the bottom of a hill, in the summer dusk; a
furry warmth, golden midges.
----- 32 columns -----
0123456789ABCDEFGHIJ My very
photogenic mother died in a
freak accident (picnic,
lightning) when I was three,
and, save for a pocket of
warmth in the darkest past,
nothing of her subsists within
the hollows and dells of
memory, over which, if you can
still stand my style (I am
writing under observation), the
sun of my infancy had set:
surely, you all know those
redolent remnants of day
suspended, with the midges,
about some hedge in bloom or
suddenly entered and traversed
by the rambler, at the bottom
of a hill, in the summer dusk;
a furry warmth, golden midges.
----- 10 columns -----
0123456789
ABCDEFGHIJ
My
very
photogenic
mother
died in a
freak
accident
(picnic,
lightning)
when I
was
three,
and, save
for a
pocket of
warmth in
the
darkest
past,
nothing
of her
subsists
within
the
hollows
and dells
of
memory,
over
which, if
you can
still
stand my
style (I
am
writing
under
observatio
n), the
sun of my
infancy
had set:
surely,
you all
know
those
redolent
remnants
of day
suspended,
with the
midges,
about
some
hedge in
bloom or
suddenly
entered
and
traversed
by the
rambler,
at the
bottom of
a hill,
in the
summer
dusk; a
furry
warmth,
golden
midges.
----- 1 column -----
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
G
H
I
J
M
y
v
e
r
y
p
h
o
t
o
g
e
n
i
c
m
o
t
h
e
r
d
i
e
d
i
n
a
f
r
e
a
k
a
c
c
i
d
e
n
t
(
p
i
c
n
i
c
,
l
i
g
h
t
n
i
n
g
)
w
h
e
n
I
w
a
s
t
h
r
e
e
,
a
n
d
,
s
a
v
e
f
o
r
a
p
o
c
k
e
t
o
f
w
a
r
m
t
h
i
n
t
h
e
d
a
r
k
e
s
t
p
a
s
t
,
n
o
t
h
i
n
g
o
f
h
e
r
s
u
b
s
i
s
t
s
w
i
t
h
i
n
t
h
e
h
o
l
l
o
w
s
a
n
d
d
e
l
l
s
o
f
m
e
m
o
r
y
,
o
v
e
r
w
h
i
c
h
,
i
f
y
o
u
c
a
n
s
t
i
l
l
s
t
a
n
d
m
y
s
t
y
l
e
(
I
a
m
w
r
i
t
i
n
g
u
n
d
e
r
o
b
s
e
r
v
a
t
i
o
n
)
,
t
h
e
s
u
n
o
f
m
y
i
n
f
a
n
c
y
h
a
d
s
e
t
:
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