Copy a string: Difference between revisions

String copy in Factor (strings and sbufs)
(String copy in Factor (strings and sbufs))
Line 117:
Src = "Hello".
Dst = Src.
 
=={{header|Factor}}==
 
Factor strings are mutable but not growable. Strings will be immutable in a future release.
 
"This is a mutable string." dup ! reference
"Let's make a deal!" dup clone ! copy
"New" " string" append . ! new string
"New string"
 
Factor string buffers (sbufs) are mutable and growable.
 
SBUF" Grow me!" dup " OK." append
SBUF" Grow me! OK."
 
Convert a string buffer to a string.
 
SBUF" I'll be a string someday." >string .
"I'll be a string somday."
 
=={{header|Forth}}==
Anonymous user