Remove the last char from an IOBuffer in-place?

I’m trying to append to a string so I use an IOBuffer as it operates in place. I tried to print \b but it’s reserved in the IOBuffer:

julia> io=IOBuffer()
IOBuffer(data=UInt8[...], readable=true, writable=true, seekable=true, append=false, size=0, maxsize=Inf, ptr=1, mark=-1)

julia> print(io,"abc\bd")

julia> String(take!(io))
"abc\bd"

The function truncate can be used to change the length of a file

2 Likes