GOLF(2gg)

NAME
replace-string - (strings)

PURPOSE
Replaces part of string.

SYNTAX

        replace-string <string> \
            ( copy <replacement> ) | ( copy-end <replacement> ) \
            [ start-with <start with> ] \
            [ length <length> ]

DESCRIPTION
replace-string will replace part of <string> with <replacement> string. "copy" clause will make a replacement in the leading part of <string>, while "copy-end" will make a replacement in the trailing part of <string>.

If "length" clause is not used, then the entire <replacement> string is used, otherwise only the <length> leading bytes of it.

If "start-with" clause is used, then <replacement> will be copied starting with byte <start with> in <string> ("0" being the first byte) (with "copy" clause) or starting with <start with> bytes prior to the end of <string> (with "copy-end" clause).

If "start-with" clause is not used, then <replacement> will replace the leading part of <string> (with "copy" clause") or the very last part of <string> (with "copy-end" clause). In either case, the number of bytes copied is determined by whether "length" clause is used or not.

If either "start-with" or "length" is negative, it's the same as if not specified.

EXAMPLES
After replace-string below, string "a" will be "none string is here":

        set-string b="none"
        set-string a="some string is here"
        replace-string a copy b

After replace-string below, string "a" will be "some string is none":

        set-string b="none"
        set-string a="some string is here"
        replace-string a copy-end b

In this example, "a" will be "somnontring is here":

        set-string b="none"
        set-string a="some string is here"
        replace-string a copy b start-with 3 length 3

In the following example, "a" will be "some string inohere":

        set-string b="none"
        set-string a="some string is here"
        replace-string a copy-end b start-with 6 length 2

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