The features described in this topic are obsolete
and should not be used in new IDL code.
STR_SEP
This routine is obsolete and should not be used in new IDL code.
The STR_SEP function has been replaced by STRSPLIT for single character delimiters, and STRSPLIT with the REGEX keyword set for longer delimiters. See "STRSPLIT" (IDL Reference Guide).
The STR_SEP function divides a string into pieces as designated by a separator string. STR_SEP returns a string array where each element is a separated piece of the original string.
Syntax
Result = STR_SEP( Str, Separator [, /TRIM] [, /REMOVE_ALL] [, /ESC] )
Arguments
Str
The string to be separated.
Separator
The separator string.
Keywords
TRIM
Set this keyword to remove leading and trailing blanks from each element of the returned string array. TRIM performs STRTRIM(String, 2).
REMOVE_ALL
Set this keyword to remove all blanks from each element of the returned string array. REMOVE_ALL performs STRCOMPRESS(String, /REMOVE_ALL)
ESC
Set this keyword to interpret the characters following the <ESC> character literally and not as separators. For example, if the separator is a comma and the escape character is a backslash, the character sequence "a\,b" is interpreted as a single field containing the characters "a,b".
Example
; Create a string: str = 'Doug.is.a.cool.dude!' ; Separate the parts between the periods: parts = STR_SEP(str, '.') ; Confirm that the string has been broken up into 5 elements: HELP, parts PRINT, parts[3]