next up previous
Next: CHR_DTOAN - Write a DOUBLE PRECISION value into a string as hr/deg:min:sec
Up: Routine Descriptions
Previous: CHR_DCWRD - Split a string into its component words

CHR_DELIM  -  Locate a substring using a given delimiter character

Description:
The given character string is examined to see if it contains a substring delimited by the character, DELIM. The indices of the first and last characters of the substring are returned as INDEX1 and INDEX2 respectively. If no occurrence of the specified delimiter is found, or if the only occurrence is the last character of the string, then the indices are returned pointing to the whole of the input string. If only one occurrence of the delimiter is found and it is not the last character in the string, INDEX1 will point to this position and INDEX2 will point to the last character in the string. If there are more than two of the occurrences of the delimiter character, INDEX1 will point to the first occurrence and INDEX2 to the last occurrence.

Invocation:
CALL CHR_DELIM( STRING, DELIM, INDEX1, INDEX2 )

Arguments:
STRING = CHARACTER ( ) (Given)
The character string to be searched.
DELIM = CHARACTER 1 (Given)
The substring delimiting character.
INDEX1 = INTEGER (Returned)
The position of the first occurrence of the delimiter, or the first character in the string.
INDEX2 = INTEGER (Returned)
The position of the last occurrence of the delimiter, or the last character in the string.



next up previous
Next: CHR_DTOAN - Write a DOUBLE PRECISION value into a string as hr/deg:min:sec
Up: Routine Descriptions
Previous: CHR_DCWRD - Split a string into its component words



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