String Operations

IDL supports several basic string operations, as described below:

Table 14-1: String Operations 

Operation
Description

Concatenation

The Addition operator, "+", can be used to concatenate strings together. See String Concatenation.

Formatting Data

The STRING function is used to format data into a string. The READS procedure can be used to read values from a string into IDL variables. See Using STRING to Format Data.

Case Folding

The STRLOWCASE function returns a copy of its string argument converted to lowercase. Similarly, the STRUPCASE function converts its argument to uppercase. See Case Folding.

White Space Removal

The STRCOMPRESS and STRTRIM functions can be used to eliminate unwanted white space (blanks or tabs) from their string arguments. See Whitespace.

Length

The STRLEN function returns the length of its string argument. See Finding the Length of a String.

Substrings

The STRPOS, STRPUT, and STRMID routines locate, insert, and extract substrings from their string arguments. See Substrings.

Splitting and Joining Strings

The STRSPLIT function is used to break strings apart, and the STRJOIN function can be used to and glue strings together. See Splitting and Joining Strings

Comparing Strings

The STRCMP, STRMATCH, and STREGEX functions perform string comparisons. See Comparing Strings.