Copy a string: Difference between revisions

Content added Content deleted
(String copy in Factor (strings and sbufs))
Line 117: Line 117:
Src = "Hello".
Src = "Hello".
Dst = Src.
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}}==
=={{header|Forth}}==