See Also: String Functions, Insert, Pos, Remove, Replace
Overstrike returns a host string which has some or all of its characters replaced by a new string at a specified position in the host string.
(Overstrike( {new-string}, {host-string}, {position} ))
Where:
{new-string} is the string that will be merged into the {host-string}
{host-string} is the string that {new-string} will be merged into
{position} is the number of characters from the left of {host-string} that the {new-string} will be inserted. The {position} parameter is 1-based (position 1 represents the first character in the host string).
Overstrike replaces the characters in {host-string} starting at {position} with the value of {new-string}.
Move "Fish not Chips" To sMenu
Showln (Overstrike("and", sMenu, 6))
In this example, the string "Fish and Chips" is shown.
The overstrike function resembles the mode of word processors known as overtype.
If the {position} parameter is 0 or negative, 1 is assumed. The characters in {new-string} will overstrike those of {host-string}.
Show (Overstrike("123456789", "Begin hostString", -3))
The first four characters of 123456789 will be truncated, and the next five will overwrite the first five characters of "Begin hostString". This example would show "123456789tString".
If {position} is greater than the length of {host-string}, {host-string} will be padded with blanks in order to append {new-string} to the position named in the {position} parameter.
Show (Overstrike("123456789", "automaton", 14))
This example would show "automaton ····123456789", where · represents a space.
This function returns a value of type string. If the result of this function is moved to a variable of type other than string, its value is converted to the type of the destination variable.
If the {new-string} or {host-string} parameters are of type other than string, their value will be converted to a string for output.