STRPUT procedure inserts the contents of one string into another. The source string,
, is inserted into the destination string,
, starting at the given position,
. Characters in
before the starting position and after the starting position plus the length of
remain unchanged. The length of the destination string is not changed. If the insertion extends past the end of the destination, it is clipped at the end.
Destination, Source [, Position]
The named string variable into which
must be a named variable of type string. If it is an array,
is inserted into every element of the array.
A scalar string to be inserted into
. If this argument is not a string, it is converted using IDL's default formatting rules.
The character position at which the insertion is begun. If
is omitted, the insertion begins at the first character (character position 0). If
is less than zero, zero is used for the initial position.
If the variable A contains the string "IBM is fun", the substring "IBM" can be overwritten with the string "IDL" by entering:
STRPUT, A, 'IDL', 0
The following commands demonstrate the clipping of output that extends past the end of the destination string:
STRPUT, A, 'FUNNY', 7
IDL is FUN