next up previous
Next: CHR_CTOC - Write a CHARACTER string into another string
Up: Routine Descriptions
Previous: CHR_CLEAN - Remove all unprintable characters from a string

CHR_COPY  -  Copy one string to another, checking for truncation

Description:
This routine copies one character string to another, checking for truncation caused by the returned string being too short to accommodate the entire given string. As much of the given string as possible is copied to the returned string, ignoring any trailing blanks. If truncation is found, it is indicated by the returned status. Optionally, the last character of the returned string may also be set to '#' if truncation occurs.

Invocation:
CALL CHR_COPY( STR1, TRUNC, STR2, LSTAT )

Arguments:
STR1 = CHARACTER ( ) (Given)
The given string.
TRUNC = LOGICAL (Given)
A logical flag indicating the action to be taken if truncation occurs: if TRUNC is .TRUE., a '#' will be written into the last element of the returned string on truncation; if TRUNC is .FALSE., no '#' is written to the returned string.
STR2 = CHARACTER ( ) (Returned)
The returned string. This will contain the given string, possibly truncated.
LSTAT = INTEGER (Returned)
The status: 0 for success, 1 if truncation occurs.



next up previous
Next: CHR_CTOC - Write a CHARACTER string into another string
Up: Routine Descriptions
Previous: CHR_CLEAN - Remove all unprintable characters from a string



CHR Character Handling Routines
Starlink User Note 40
A C Charles
P C T Rees
A J Chipperfield
2 August 1995
E-mail:ussc@star.rl.ac.uk