Copy a string: Difference between revisions

(Removed infobox formatting.)
Line 84:
==[[Forth]]==
[[Category:Forth]]
 
Forth strings are generally stored in memory as prefix counted string, where the first byte contains the string length. However, on the stack they are most often represented as <addr cnt> pairs. Thus the way you copy a string depends on where the source string comes from:
 
\ Allocate two string buffers
create stringa 256 allot
create stringb 256 allot
\ Copy a constant string into a string buffer
s" String A" stringb place
\ Copy the contents of one string buffer into another
stringa count stringb place
 
==[[Fortran]]==
Anonymous user