next up previous
Next: CHR_TRUNC - Truncate a string at a given delimiter
Up: Routine Descriptions
Previous: CHR_TOCHR - Skip to the next specified character in a string

CHR_TRCHR  -  Translate the specified characters in a string

Description:
Translate a specified set of characters within a string. The character translation is controlled by the translation table given by the character strings FROM and TO. Any characters not appearing in the translation table are left unchanged. If the status is set on entry, no action is taken. If the strings FROM and TO are unequal in length, STATUS is returned set to SAI__ERROR.

Invocation:
CALL CHR_TRCHR( FROM, TO, STRING, STATUS )

Arguments:
FROM = CHARACTER ( ) (Given)
A string specifying the characters to be translated.
TO = CHARACTER ( ) (Given)
A string specifying the translation values for each of the characters in the FROM argument. The lengths of the FROM and TO arguments must be the same.
STRING = CHARACTER ( ) (Given and Returned)
The string to be translated. Any character matching one of the characters specified in the FROM argument is converted to the corresponding character specified in the TO argument. All other characters are left unchanged.
STATUS = INTEGER (Given and Returned)
The global status: returned set to SAI__ERROR if FROM and TO have unequal lengths.



next up previous
Next: CHR_TRUNC - Truncate a string at a given delimiter
Up: Routine Descriptions
Previous: CHR_TOCHR - Skip to the next specified character in 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