STR_SEP

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.

This routine is written in the IDL language. Its source code can be found in the file str_sep.pro in the lib subdirectory of the IDL distribution.

Calling Sequence

Result = STR_SEP( Str , Separator )

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

str = 'Doug.is.a.cool.dude!' ; Create a string.

parts = STR_SEP(str, '.') ; Separate the parts between the periods.

HELP, parts ; Confirm that the string has been broken up into 5 elements.

IDL prints:

PARTS   STRING = Array[5]

PRINT, parts[3]

IDL prints:"

cool

See Also

STRMID , STRPOS