Skip to content

deblank

Remove trailing whitespace from a string.

s = deblank(str)

Strips trailing whitespace (spaces, tabs, newlines) from str. Leading whitespace is preserved. Applied elementwise to cell arrays of strings.

deblank(' hello ') % ' hello'
  • strtrim — Remove leading and trailing whitespace from a string.
  • strtrunc — Truncate a string to a specified length.