isspace

Array elements that are space characters

Syntax

tf = isspace('str')

Description

tf = isspace('str') returns an array the same size as 'str' containing logical 1 (true) where the elements of str are Unicode®-represented whitespace characters, and logical 0 (false) where they are not.

Whitespace characters for which isspace returns true include tab, line feed, vertical tab, form feed, carriage return, and space, in addition to a number of other Unicode characters. To see all characters for which isspace returns true, enter the following command, and then look up the returned decimal codes in a Unicode reference:

find(isspace(char(1):char(intmax('uint16'))))

Examples

isspace('  Find spa ces ')
  Columns 1 through 13 
     1   1   0   0   0   0   1   0   0   0   1   0   0
  Columns 14 through 15 
     0   1
Was this topic helpful?