MATLAB Function Reference Previous page   Next Page
strtrim

Remove leading and trailing white-space from string

Syntax

Description

S = strtrim(str) returns a copy of string str with all leading and trailing white-space characters removed. A white-space character is one for which the isspace function returns logical 1 (true).

C = strtrim(cstr) returns a copy of the cell array of strings cstr with all leading and trailing white-space characters removed from each string in the cell array.

Examples

Remove the leading white-space characters (spaces and tabs) from str:

Remove leading and trailing white-space from the cell array of strings:

See Also

isspace, cellstr, deblank


Previous page  strtok struct Next page

© 1994-2005 The MathWorks, Inc.