STRCOMPRESS

The STRCOMPRESS function returns a copy of String with all whitespace (blanks and tabs) compressed to a single space or completely removed.

Calling Sequence

Result = STRCOMPRESS( String )

Arguments

String

The string to be compressed. If not of type string, it is converted using IDL's default formatting rules. If String is an array, the result is an array with the same structure--each element contains a compressed copy of the corresponding element of String .

Keywords

REMOVE_ALL

Set this keyword to remove all whitespace. Normally, all whitespace is compressed to a single space.

Example

Create a string variable S by entering:

S = 'This is a string with spaces in it.'

Now print S with all of the whitespace removed by entering:

PRINT, STRCOMPRESS(S, /REMOVE_ALL)

IDL prints:

Thisisastringwithspacesinit.

See Also

STRTRIM