Skip to content

deblank

strings · scripts/strings/deblank.m

: s = deblank (s)

Strip white space and null characters from the end of text.

Leading white space is kept. For a character matrix every row is stripped and the result is padded to the longest remaining row. For a cell array each string inside it, at any depth, is stripped.

deblank ("  width   ")
     ⇒   "  width"

deblank (["ab   "; "  cd "])
     ⇒   ["ab  "; "  cd"]