replace-string - (strings)
Contents
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
Name
replace-string - (strings)
Purpose
Replaces part of string.
See Also
Strings
concatenate-stringscopy-stringcount-substringdelete-stringlower-stringnew-stringread-splitreplace-stringset-stringsplit-stringstring-lengthtrim-stringupper-stringwrite-string See all documentation
$DATE $VERSION GOLF(2gg)
Syntax
replace-string <string> \
( copy <replacement> ) | ( copy-end <replacement> ) \
[ start-with <start with> ] \
[ length <length> ]
