I think for this example you don't need to add the space within the <# #>
stuff. You can define strings with leading or trailing spaces with s"
.
So if you start with
\ Push addresses and lengths for the prefix and the number
s" prefix " \ -- addr u
123 s>d <# #s #> \ addr u -- addr u addr2 u2
The word that you want is something that concatenates them, for example:
: concatenate
\ Moves the string addr2 u2 to the end of the string addr u
>r >r \ addr u addr2 u2 -- addr u
dup >r over r> + r> \ addr u -- addr u addr+u addr2
swap r@ \ addr u -- addr u addr2 addr+u u2
cmove r> + ; \ addr u addr2 addr+u u2 -- addr u+u2
So if you call this and output the resulting string like this:
concatenate type
The output will be "prefix 123"
You could then apply the same word to the strings "prefix 123" and " suffix".
This doesn't use exactly the same memory locations as your example but it could be adapted, and just was the easiest way that I could demonstrate it.
In response to the comment, you seem to be pretty close to embedding characters in pictured output, I think you just need to remove the [char]
e.g.
123 s>d <# # bl hold # bl hold # #>
Should generate a string like "1 2 3"