GOLF(2gg)

NAME
copy-string - (strings)

PURPOSE
Copies string to another string.

SYNTAX

        copy-string <source string> to <dest string> \
            [ start-with <start with> ] \
            [ length <length> ]

DESCRIPTION
Use copy-string to copy <source string> to <dest string>.

<start with> number (in "start-with" clause) is the position in <source string> to start copying from, with 0 being the first byte.

Without "length" clause, the whole of <source string> is copied. With "length" clause, exactly <length> bytes are copied into <dest string>.

You can copy a string to itself. In this case, the original string remains and the new string references a copy:

        set-string str = "original string" // string to change

        set-string orig = str // references original copy of the string to change

        copy-string str to str // make a copy of string to change and assign it to itself

        upper-string str // change the copy

        // Now "str" references "ORIGINAL STRING"
        // and "orig" references "original string"

EXAMPLES
After copy-string below, "my_str" will be a copy of string "some value":

        set-string other_string="some value"
        copy-string other_string to my_str

Copy certain number of bytes, the result in "my_str" will be "ome":

        set-string other_string="some value"
        copy-string other_string to my_str length 3 start-with 1

SEE ALSO
 Strings

concatenate-strings copy-string count-substring delete-string lower-string new-string read-split replace-string set-string split-string string-length trim-string upper-string write-string See all documentation