faster way to add data[x] to a string

BlitzMax Forums/BlitzMax Beginners Area/faster way to add data[x] to a string

Panno(Posted 2016) [#1]
hi,

i need to copy a byte[] to the end of a string

sometime ive got up to 1000 byte and my routine screws up.

do you know a better / faster way ?

local data:byte[4096]
local dat:string

for r = 1 to xxx
dat = dat+chr$ (data[r])
next

thx


grable(Posted 2016) [#2]
str :+ String.FromBytes( data, data.Length)
Still one too many allocations but better than increasing the string by 1 each time.


Panno(Posted 2016) [#3]
this works fine.

thanks grable