next up previous
Next: CHR_DELIM - Locate a substring using a given delimiter character
Up: Routine Descriptions
Previous: CHR_CTOR - Read a REAL value from a string

CHR_DCWRD  -  Split a string into its component words

Description:
All the words in the given character string are detected and returned as individual elements of a character array. In this context, a word is defined as a continuous string of non-blank characters. Hence words must be separated from each other by one or more blanks.

Invocation:
CALL CHR_DCWRD( STRING, MXWRD, NWRD, START, STOP, WORDS, LSTAT )

Arguments:
STRING = CHARACTER ( ) (Given)
The string to be split into its constituent words.
MXWRD = INTEGER (Given)
The maximum number of words that can be extracted from the given string: if there are more than MXWRD words in the string, only the first MXWRD will be returned.
NWRD = INTEGER (Returned)
The number of words located in the string.
START( MXWRD ) = INTEGER (Returned)
The Ith element contains the position of the first element of the Ith word in the given string.
STOP( MXWRD ) = INTEGER (Returned)
The Ith element contains the position of the last element of the Ith word in the given string.
WORDS( MXWRD ) = CHARACTER ( ) (Returned)
The Ith element contains the Ith word located in the given string.
LSTAT = INTEGER (Returned)
The local status. This is a return status only: the routine is not affected by the value on input. It has the following values: SAI__OK for successful completion, SAI__ERROR if the number of words exceeds MXWRD.



next up previous
Next: CHR_DELIM - Locate a substring using a given delimiter character
Up: Routine Descriptions
Previous: CHR_CTOR - Read a REAL value 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