>  Docs Center  >  Libraries  >  ASTROLIB  >  STR_INDEX
Libraries

STR_INDEX

STR_INDEX

Name


      STR_INDEX()

Purpose


      Get indices of a substring (SUBSTR) in string.

Explanation


      The IDL intrinsic function STRPOS returns only the index of the first
      occurrence of a substring. This routine calls itself recursively to get
      indices of the remaining occurrences.

Calling Sequence


      result= STR_INDEX(str, substr [, offset])

Inputs


      STR -- The string in which the substring is searched for
      SUBSTR -- The substring to be searched for within STR

Optional Inputs


      OFFSET -- The character position at which the search is begun. If
                omitted or being negative, the search begins at the first
                character (character position 0).

Outputs


      RESULT -- Integer scalar or vector containing the indices of SUBSTR
                within STR. If no substring is found, it is -1.

Calls


      DELVARX

Common Blocks


      STR_INDEX -- internal common block. The variable save in the block is
                    deleted upon final exit of this routine.

Category


      Utility, string

Modification History


      Written January 3, 1995, Liyun Wang, GSFC/ARC
      Converted to IDL V5.0 W. Landsman September 1997
      Use size(/TNAME) instead of DATATYPE() W. Landsman October 2001
     



© 2024 NV5 Geospatial Solutions, Inc. |  Legal
   Contact Us