The STRPUT procedure inserts the contents of one string into another. The source string, Source, is inserted into the destination string, Destination, starting at the given position, Position. Characters in Destination before the starting position and after the starting position plus the length of Source 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.
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
STRPUT, Destination, Source [, Position]
The named string variable into which Source is inserted. Destination must be a named variable of type string. If it is an array, Source is inserted into every element of the array.
A scalar string to be inserted into Destination. 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 Position is omitted, the insertion begins at the first character (character position 0). If Position is less than zero, zero is used for the initial position.
This page has no comments yet. Be the first one!